diff --git a/lib/core/Axios.js b/lib/core/Axios.js index 386dc01..cff383e 100644 --- a/lib/core/Axios.js +++ b/lib/core/Axios.js @@ -20,7 +20,7 @@ const validators = validator.validators; */ class Axios { constructor(instanceConfig) { - this.defaults = instanceConfig; + this.defaults = instanceConfig || {}; this.interceptors = { request: new InterceptorManager(), response: new InterceptorManager() diff --git a/test/unit/core/Axios.js b/test/unit/core/Axios.js index 8958ad1..a4d62ac 100644 --- a/test/unit/core/Axios.js +++ b/test/unit/core/Axios.js @@ -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, {}); + }); });