[Dojo-interest] JsonRestStore and CORS

saamorim saamorim at gmail.com
Tue Jun 17 05:56:07 EDT 2014


Hi Guys.

I've configured a store in a client with the domain www.somewhere.com:
    "stores": {
        "createaccount": {
            "type": "dojo/store/JsonRest",
            "params": {
                "target":
"http://srv.somewhere.com/app_dev.php/api/account/create",
                "idProperty": "userId",
                "headers": {
                    "X-Requested-With": null
                }
            }
        }
    }

and in the controller I'm calling the put in the store

var mystore = this.loadedStores.createaccount;
mystore.headers = {
                "X-Requested-With": null
            };
var promisse = mystore.put(jsonData).then(this.handleStorePutSucess,
this.handleStorePutError);



The problem is that the store is sending the preflight method (OPTIONS) to
the server, which I don't want.

As you may see, I've polluted the code with X-Requested-With header but it
is ignored and tries to do the OPTIONS method. 

If I just use:

 var promisse = request.post(mystore.target, {
                data: jsonData,
                handleAs : 'json',
                headers: {
                    "X-Requested-With": null
                },
                sync: false
            });

all is good, and the POST is done.

Can any one help?

Thank you
(using Dojo 1.9)



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


More information about the Dojo-interest mailing list