0

The service works when i am not sending any data or if i am sending data as url params. When i am trying to send data as post params the response status code is 405 (method not allowed). Below is the AngularJS service method that i am using.

this.editAuthUser = function (url) {
    var data = { email: 'abc@xyz.com', username: 'test'};       
    return $http({
        url: url,
        method: 'POST',
        headers: { 'Content-Type':'application/json; charset=utf-8'},
        data: data
    });
};

I am sharing the image of the headers as displayed in developer tools. headers_img

georgeawg
  • 48,608
  • 13
  • 72
  • 95
  • This might be a server side problem. As a test, try removing the headers from your $http request and check if you get something on that route – Ionel Lupu Feb 03 '17 at 07:24
  • I removed them its still not working. I tested this service in POSTMAN app and it was working. – Sandeep Kumar Feb 03 '17 at 07:28
  • What is the url for that request? Are you getting any 'Cross origin requests' errors in console? – Ionel Lupu Feb 03 '17 at 07:31
  • In console i am getting this XMLHttpRequest cannot load http://54.152.19.207/DataAnalysis/ProductService.svc/UpdateUserData. Response for preflight has invalid HTTP status code 405 – Sandeep Kumar Feb 03 '17 at 07:41
  • Take a look at this. http://stackoverflow.com/questions/33514687/response-for-preflight-has-invalid-http-status-code-405 – Ionel Lupu Feb 03 '17 at 07:48
  • Okay i am checking this link and will make changes on the serverside and let you know. Thank you for your quick response. – Sandeep Kumar Feb 03 '17 at 07:53
  • Can you please post the declaration of web method you are trying to hit to? – Pushpendra Feb 03 '17 at 08:03

0 Answers0