plovr

Http-Method changes from POST to OPTIONS when changing Content-Type

為{幸葍}努か 提交于 2020-01-11 03:20:09
问题 I am using closure library to do a simple POST. I think XhrIo should work because from my machine when I use any other rest client ,like Firefox browser app RESTClient or Chrome's Simple Rest Client , I can make POST request to the server and content type is application/json. But from my application I am unable to make a post. I am using the following code xhr = new goog.net.XhrIo; xhr.send('http://myhost:8181/customer/add','POST', goog.json.serialize(data)); If I leave the headers default, I

Http-Method changes from POST to OPTIONS when changing Content-Type

时间秒杀一切 提交于 2019-11-30 22:15:53
I am using closure library to do a simple POST. I think XhrIo should work because from my machine when I use any other rest client ,like Firefox browser app RESTClient or Chrome's Simple Rest Client , I can make POST request to the server and content type is application/json. But from my application I am unable to make a post. I am using the following code xhr = new goog.net.XhrIo; xhr.send('http://myhost:8181/customer/add','POST', goog.json.serialize(data)); If I leave the headers default, I get this Encoding: UTF-8 Http-Method: POST Content-Type: application/x-www-form-urlencoded;charset=UTF