How can I set global http headers for ajax requests?
I want to send the device ID in every request to my server. What's the easiest way to globally set headers without regard to what store is being used (inline or a defined class)?
I came up with this, which works but feels rather hacky:
Code:
Ext.override(Ext.data.proxy.Ajax, {
constructor: function(config) {
config.headers || (config.headers = {});
config.headers.uuid = 'SOME-EXAMPLE-UUID';
return this.callOverridden([config]);
}
});
I'm new to Sencha Touch, so any help is appreciated.