2
0
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:
Ell Bradshaw
2024-09-26 12:31:24 -07:00
committed by GitHub
parent 00de614cd0
commit 8f3cde11d2
3 changed files with 29 additions and 0 deletions
+16
View File
@@ -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/'