PDA

View Full Version : Jsonp request header token



andre40826
2 Oct 2012, 4:04 AM
I have a proxy in store with jsonp type and need to send in header request one token.


Ext.define("Mobile.store.ListInvoices",{

extend: "Ext.data.Store",
config:{
model: 'Mobile.model.Invoice',

proxy: {
type: 'jsonp',
url : 'http://localhost:8080/app/api/invoices/',
reader: {
type: 'json'
},

headers:{
'token':'8Dx19DRGAd'
}
},
autoLoad: true

}

});

The problem is that the token is not sent

skirtle
2 Oct 2012, 4:41 AM
You can't control the headers in a JSON-P request, remember it's just an injected script tag. A server that supports JSON-P shouldn't be expecting you to set headers. You have to use request parameters instead.

Make sure you have a clear and thorough understanding of how JSON-P works. You may find CORS a viable alternative depending on your requirements.