How can I add a request header to an ExtJS ajax request?
I specifically want to add the header: accept-encoding
to equal true.
How can I add a request header to an ExtJS ajax request?
I specifically want to add the header: accept-encoding
to equal true.
You can specify request headers like this:
Ext.Ajax.request({
url: 'yourUrl',
headers: {
'accept-encoding': 'true'
}
})
Have you tried the headers
config in the Ajax request:
Ext.Ajax.request({
url: 'someURL',
headers: {
'accept-encoding': true
}
});
If you want to add a header to all Extjs ajax requests:
Ext.Ajax.defaultHeaders = {
'accept-encoding' : true
};
With ExtJs 6. Ext.Ajax.defaultHeaders doesn't work. But using the following setter works
Ext.Ajax.setDefaultHeaders({
'accept-encoding' : true
});
© 2022 - 2024 — McMap. All rights reserved.