Angular http post method sends data as query string?

Hi, I ran into a problem over the angular http post method. If I try to send data using the http: URL, then it sends the data as a query string. since I am transmitting very large data, this gives me an error: the server responded with a status of 414 (Request-URI Too Long).

here is my http post factory method:

dataFactory.InsertInAdditionalDataDetailsIdBulk = function (AdditionalDataDetailsIds, AdditionalDataID, AdditionalDataName, AdditionalDataDate) { var params = { AdditionalDataDetailsIds: AdditionalDataDetailsIds, AdditionalDataID: AdditionalDataID, AdditionalDataName: AdditionalDataName, AdditionalDataDate: AdditionalDataDate } return $http({ url: '/GroupsManager/InsertInAdditionalDataDetailsIdBulk', method: 'POST', params: params }); }; 

Why is my data sent as a query string parameter even after using the Post method?

+6
source share
1 answer

Put the parameters in the data key.

 return $http({ url: '/GroupsManager/InsertInAdditionalDataDetailsIdBulk', method: 'POST', data: params }); 

https://docs.angularjs.org/api/ng/service/$http

+11
source

Source: https://habr.com/ru/post/987627/


All Articles