You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Experienced the same issue. It might be more of a conceptual issue than an implementation detail. Seems to me that setting a baseURL is a way of saying "prepend this to every request", which seems kind of pointless when you set it on every request. Although a case could definitely be made for a conditional like:
But it doesn't work. Setting a global default like this does: axios.defaults.baseURL = 'https://example.com';
as does passing a config with the request: axios.post('/extra', { baseURL: 'https://example.com' })
In both cases the 'url' field of the config is 'https://example.com/extra', but setting the baseURL in the interceptor only updates 'config.baseURL'. I mean it makes sense why, you're literally just updating that field, but it would be nice if it updated the url field as well or at least mentioned in the docs (preferably in big bold lettering) that setting baseURL in an interceptor is useless/not recommended.
@Baoyx007 you can always just change the 'url' value in the config manually
Activity
mrerhuo commentedon Jun 20, 2017
look me Custom instance defaults axios.all is not a function #948 my working normal only all is not a function
hectim commentedon Jun 23, 2017
Experienced the same issue. It might be more of a conceptual issue than an implementation detail. Seems to me that setting a baseURL is a way of saying "prepend this to every request", which seems kind of pointless when you set it on every request. Although a case could definitely be made for a conditional like:
But it doesn't work. Setting a global default like this does:
axios.defaults.baseURL = 'https://example.com';as does passing a config with the request:
axios.post('/extra', { baseURL: 'https://example.com' })In both cases the 'url' field of the config is 'https://example.com/extra', but setting the baseURL in the interceptor only updates 'config.baseURL'. I mean it makes sense why, you're literally just updating that field, but it would be nice if it updated the url field as well or at least mentioned in the docs (preferably in big bold lettering) that setting baseURL in an interceptor is useless/not recommended.
@Baoyx007 you can always just change the 'url' value in the config manually
or on every request
Node v7.10.0
Axios v0.16.12
fixing bug for issue axios#175 maybe axios#949 axios#443
rubennorte commentedon Aug 12, 2017
Fixed in #950