mirror of
https://github.com/tenrok/axios.git
synced 2026-05-15 11:59:42 +03:00
Fixing baseURL not working in interceptors (#950)
* Fixing baseURL not working in interceptors * add test for modify base URL in request interceptor
This commit is contained in:
@@ -252,4 +252,22 @@ describe('interceptors', function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should modify base URL in request interceptor', function (done) {
|
||||
var instance = axios.create({
|
||||
baseURL: 'http://test.com/'
|
||||
});
|
||||
|
||||
instance.interceptors.request.use(function (config) {
|
||||
config.baseURL = 'http://rebase.com/';
|
||||
return config;
|
||||
});
|
||||
|
||||
instance.get('/foo');
|
||||
|
||||
getAjaxRequest().then(function (request) {
|
||||
expect(request.url).toBe('http://rebase.com/foo');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user