Overriding defaultHeaders and method not working Ext.Ajax override with sencha 6.2

300 views Asked by At

I had Ext.Ajax overriden with defaultHeaders and method in Extjs4.2-

Ext.define('overrides.Ajax', {
override: 'Ext.Ajax',
defaultHeaders: { 'Content-Type': 'application/json; charset=utf-8' },
method: 'POST',

But with Extjs 6.2 defaultHeaders and method is not setting. Any idea on the issue?

1

There are 1 answers

1
A. Llorente On

I don't know why that doesn't work but we had the same issue in the past, we solved it by setting the default headers via set method:

Ext.Ajax.setDefaultHeaders({
    'charset': 'utf-8',
    'Content-Type'         : 'application/json'
});

I don't know if it is the best way to go but it is a way. We have this code in the Application.js