I am trying to post a json string to a REST service. The following code is being used:
dojo.xhrPost( {
url: REST_URL,
postData: jsonData,
handleAs: "json",
headers: {"Content-Type": "application/json"},
load: function(response, ioArgs) {
alert(response);
},
error: function(response, ioArgs) {
alert(response);
}
});
I intercept the requests sent by the browsers (IE/Firefox) using fiddler. When I submit the request from IE, fiddler shows the Content-type header being set to "application/json".
However, when the same request is submitted using Firefox, the Content-type header is not visible in the request headers (meaning not added by Firefox). My server is setup to validate for the content-type being 'application/json'. Hence, the request is rejected by the server.
Question:
I know this question is dead, but having a similar issue I found this bug report
If you are looking for that wisdom of the ancients I hope this helps ;)