繁体   English   中英

AngularJs $ http.post()请求无法正常工作

[英]AngularJs $http.post() request is not working properly

AngularJs $ http.post()请求无法正常工作

我想将一个任务存储到我的数据库中。 如果assignedMember中的数据量大于175,则不会发送404错误,但是如果assignedMember中的数据量小于175,则将发送成功并存储我的数据库。 关于这个的任何想法。 我没有我的错。 请帮我谢谢

这是我的json数据

$scope.task=

{
     "title": "My Title",
     "description": "My Description",
     "assignedMember": [
      {
       "userId": "51b701dae4b0dd92df2c32d1",
       "status": "ASSIGNED"
      },
      {
       "userId": "52de0811e4b04615ce7ed6bd",
       "status": "ASSIGNED"
      },
      {
       "userId": "559f8e97e4b0a5cdcd66bb76",
       "status": "ASSIGNED"
      },
    .
    .
    .
    .
    .
    .etc upto 500 data
     ]
}   

这是我的帖子请求API

var responsePromise = $http.post("api/tasks",$scope.task);
responsePromise.success(function(data, status, headers, config) {
    alert("Data created successfully");
});
responsePromise.error(function(data, status, headers, config) {
alert("Error")
});

如果分配的成员大小大于175或浏览器中的内容长度大于24580,当我发送此json时出现404错误

如果分配的成员大小小于175或浏览器中的内容长度小于10080,当我发送此json时它将成功

如果出现404错误,我的浏览器控制台就是这样

Request header
-------------

Host: localhost

User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0

Accept: application/json, text/plain, /

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Content-Type: application/json;charset=utf-8

Referer: http://localhost/login.do

Content-Length: 24580

Response header
--------------


Connection: close

Content-Encoding: gzip

Content-Type: text/html

Date: Thu, 15 Dec 2016 14:21:56 GMT

Server: nginx/1.10.1

Transfer-Encoding: chunked

我的Nginx服务器有什么限制吗? 请帮我

发布请求没有限制规则? 并且获取请求限制为2048KB

其实我是通过邮寄发送的,所以我面临什么问题?

Connection: close ,我认为您的服务器尚未接受大量数据。

当客户端通过发送413响应并关闭连接来通知它要发送大于client_max_body_size的正文时,nginx“快速失败”。

在发送整个请求正文之前,大多数客户端不会读取响应。 由于nginx关闭了连接,因此客户端将数据发送到关闭的套接字,从而导致TCP RST。

如果您的HTTP客户端支持,最好的处理方法是发送Expect: 100-Continue标头。 Nginx从1.2.7版本开始就正确支持此功能,如果Content-Length超过最大主体大小,Nginx将以413 Request Entity Too Large响应413 Request Entity Too Large而不是100 Continue响应。

引自

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM