Support axios Config Defaults
leomp12 opened this issue · 2 comments
leomp12 commented
https://github.com/axios/axios#config-defaults
As "the goal is to support most/all features", Config Defaults also seems to be an important feature.
Currently, something like:
instance.defaults.headers.get['Content-Type'] = 'application/json'`
Results in:
Uncaught TypeError: instance.defaults.headers is undefined
developit commented
@leomp12 I wasn't aware of that usage pattern. FWIW defaults are supported, we just don't prepopulate the headers object. You can do this:
instance.defaults = { headers: { 'Content-Type': 'application/json' } };
or this:
axios = axios.create({
headers: {
'Content-Type': 'application/json'
}
})
leomp12 commented
Great @developit , I'll give a try, thanks!