mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
Warn about common option misspellings (#6489)
* chore(tests): add failing tests for baseUrl * chore(tests): simplify to just warning * feat: warn about likely-misspelled options * chore: add semi-colon * chore: add missing semi-colons --------- Co-authored-by: Ell Bradshaw <ell@c9a.co> Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
@@ -71,6 +71,22 @@ describe('options', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should warn about baseUrl', function (done) {
|
||||
spyOn(window.console, 'warn');
|
||||
|
||||
const instance = axios.create({
|
||||
baseUrl: 'http://example.com/'
|
||||
});
|
||||
|
||||
instance.get('/foo');
|
||||
|
||||
getAjaxRequest().then(function (request) {
|
||||
expect(window.console.warn).toHaveBeenCalledWith('baseUrl is likely a misspelling of baseURL');
|
||||
expect(request.url).toBe('/foo');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should ignore base URL if request URL is absolute', function (done) {
|
||||
const instance = axios.create({
|
||||
baseURL: 'http://someurl.com/'
|
||||
|
||||
Reference in New Issue
Block a user