2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

Fixing bug with custom intances and global defaults

This commit is contained in:
Nick Uraltsev
2016-11-26 18:17:21 -08:00
parent 5faebabcd8
commit 6d0e19343a
3 changed files with 30 additions and 6 deletions
+23
View File
@@ -136,4 +136,27 @@ describe('defaults', function () {
});
});
it('should be used by custom instance if set before instance created', function (done) {
axios.defaults.baseURL = 'http://example.org/';
var instance = axios.create();
instance.get('/foo');
getAjaxRequest().then(function (request) {
expect(request.url).toBe('http://example.org/foo');
done();
});
});
it('should be used by custom instance if set after instance created', function (done) {
var instance = axios.create();
axios.defaults.baseURL = 'http://example.org/';
instance.get('/foo');
getAjaxRequest().then(function (request) {
expect(request.url).toBe('http://example.org/foo');
done();
});
});
});