2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

fix(core): fix the Axios constructor implementation to treat the config argument as optional; (#6881)

This commit is contained in:
Dmitriy Mozgovoy
2025-04-18 02:22:31 +03:00
committed by GitHub
parent dfe8411c9a
commit 6c5d4cd692
2 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ const validators = validator.validators;
*/ */
class Axios { class Axios {
constructor(instanceConfig) { constructor(instanceConfig) {
this.defaults = instanceConfig; this.defaults = instanceConfig || {};
this.interceptors = { this.interceptors = {
request: new InterceptorManager(), request: new InterceptorManager(),
response: new InterceptorManager() response: new InterceptorManager()
+7 -1
View File
@@ -43,5 +43,11 @@ describe('Axios', function () {
} }
}) })
}); });
}) });
it('should not throw if the config argument is omitted', () => {
const axios = new Axios();
assert.deepStrictEqual(axios.defaults, {});
});
}); });