Skip to content

Commit 6c5d4cd

Browse files
fix(core): fix the Axios constructor implementation to treat the config argument as optional; (#6881)
1 parent dfe8411 commit 6c5d4cd

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

lib/core/Axios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const validators = validator.validators;
2020
*/
2121
class Axios {
2222
constructor(instanceConfig) {
23-
this.defaults = instanceConfig;
23+
this.defaults = instanceConfig || {};
2424
this.interceptors = {
2525
request: new InterceptorManager(),
2626
response: new InterceptorManager()

test/unit/core/Axios.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,11 @@ describe('Axios', function () {
4343
}
4444
})
4545
});
46-
})
46+
});
47+
48+
it('should not throw if the config argument is omitted', () => {
49+
const axios = new Axios();
50+
51+
assert.deepStrictEqual(axios.defaults, {});
52+
});
4753
});

0 commit comments

Comments
 (0)