[Dojo-interest] JsonRestStore and CORS

tmahieu tom at mahieu.org
Tue Jun 17 09:36:44 EDT 2014


dylanks wrote
> The extra OPTIONS request is automatically sent by the browser whenever
> you are using CORS, except in the case of simple GET and PUT (simple
> meaning no custom headers are being set).

If I remember correctly, if you use dojo/request/xhr (directly, or
indirectly through dojo/request) to send your CORS request to the server,
dojo will add a X-Requested-With header to your ajax call, which will always
trigger the preflight request (i.e. the OPTIONS request).

If you want to avoid setting this header on your request, you can set the
value of the header to the empty string:

var promise = request(someUrl, {
  method: "POST",
  headers: {
    "X-Requested-With": ""
  }
});





--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/JsonRestStore-and-CORS-tp4002729p4002742.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.


More information about the Dojo-interest mailing list