[Dojo-interest] Additional headers not set on request

Stefan Almer stefan at grenzstein.com
Fri Aug 12 02:49:14 EDT 2011


I'm using DoJo 1.6.1 for accessing my REST web service. To get the response in JSON I need to set the "aceept" header field to "application/json".

According to the documentation this is done by setting the headers property on the request, like to following:

var xhrArgs = {
    url: "http://localhost/myservice",
    headers: { "Accept": "application/json" },
    handleAs: "json",
    load: successCallback,
    error: errorCallback
}

var deferred = dojo.xhrGet(xhrArgs);
I also used dojo.io.script.get(jsonpArgs); with the same issue: accept is of the value */* on the server side. I'm using Firefox 5.0.1 (also tried with Safari and Firefox on Windows). Firebug also says the the accept header is */*.

Any suggestions what the problem is? Thanks in advance! :)

P.S: This is a cross post to http://stackoverflow.com/questions/7031690/dojo-toolkit-additional-headers-not-set-on-request


More information about the Dojo-interest mailing list