I use a closure library to do a simple POST. I think XhrIo should work, because from my machine, when I use any other client for relaxation, for example, the Firefox RESTClient application or the Chrome Simple Rest Client, I can make a POST request to the server, and the content type is application / json .
But from my application I can not make a message. 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 default headers, I get this
Encoding: UTF-8 Http-Method: POST Content-Type: application/x-www-form-urlencoded;charset=UTF-8
If I try to change the title by passing {'content-type':'application/json'} as the 4th parameter, the title will change to
Http-Method: OPTIONS
Content-Type:
Shouldn't I change headers appropriately with the Closure library, like RESTClient does with XMLHttpRequest using jQuery?
How else can I change the title to look like this:
Encoding: UTF-8 Http-Method: POST Content-Type: application/json;charset=UTF-8
Appreciate any help Eddie
Eddie source share