6

Hi I am facing issue over angular http post method. If i try to send data using angularjs http post it sends data as a query string. as I am passing very huge data it gives me 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 my data is sent as query string parameter even after using Post method?

1 Answer 1

11

Put params in the data key..

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

});

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

1
  • ok in that case I have to catch single parameter in InsertInAdditionalDataDetailsIdBulk method right?
    – Samir Shah
    May 21, 2015 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.