简体   繁体   中英

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

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

I want to store one task to my db. If amount of data in assignedMember is more than 175 it will not send got 404 error but If amount of data in assignedMember is less than 175 it will send success and store my db. Any idea about this. I dont what wrong with me. Please help me thank you

This is my json data

$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
     ]
}   

This is my post request 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")
});

If assigned member size is more than 175 or Content Length in browser is greater than 24580 when i send this json i got 404 error

If assigned member size is less than 175 or Content Length in browser is lesser than 10080 when i send this json it will success

If i getting 404 error my browser console is like this

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

Is it any restriction in my nginx server? Please help me

Post request have no restriction rit? and get request is limited to 2048KB

Actually I am sending via post so what problem i am facing?

Connection: close , I think your server have not accept large count of data.

nginx "fails fast" when the client informs it that it's going to send a body larger than the client_max_body_size by sending a 413 response and closing the connection.

Most clients don't read responses until the entire request body is sent. Because nginx closes the connection, the client sends data to the closed socket, causing a TCP RST.

If your HTTP client supports it, the best way to handle this is to send an Expect: 100-Continue header. Nginx supports this correctly as of 1.2.7, and will reply with a 413 Request Entity Too Large response rather than 100 Continue if Content-Length exceeds the maximum body size.

Referred from

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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