From 521bbbbe58582b82f3e0f7f15d3b67eff0eb66de Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 27 Jan 2022 08:20:54 +0200 Subject: [PATCH 1/2] Removed error when url is null as this breaks current use cases for alot of projects --- lib/core/Axios.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/core/Axios.js b/lib/core/Axios.js index d7ce7db415..a1be08adae 100644 --- a/lib/core/Axios.js +++ b/lib/core/Axios.js @@ -36,10 +36,6 @@ Axios.prototype.request = function request(configOrUrl, config) { config = configOrUrl || {}; } - if (!config.url) { - throw new Error('Provided config url is not valid'); - } - config = mergeConfig(this.defaults, config); // Set config.method @@ -122,9 +118,6 @@ Axios.prototype.request = function request(configOrUrl, config) { }; Axios.prototype.getUri = function getUri(config) { - if (!config.url) { - throw new Error('Provided config url is not valid'); - } config = mergeConfig(this.defaults, config); return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); }; From b4777bdadb441dfeca22ace489185b6091e895b8 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 27 Jan 2022 08:21:32 +0200 Subject: [PATCH 2/2] Removed associated tests that check for the for url to not be empty --- test/specs/requests.spec.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/test/specs/requests.spec.js b/test/specs/requests.spec.js index e363fefb0a..a5aa81aab4 100644 --- a/test/specs/requests.spec.js +++ b/test/specs/requests.spec.js @@ -7,24 +7,6 @@ describe('requests', function () { jasmine.Ajax.uninstall(); }); - it('should throw error when missing url', function (done) { - expect(() => axios()).toThrowError(/Provided config url is not valid/); - done(); - - expect(() => axios('')).toThrowError(/Provided config url is not valid/); - done(); - - expect(() => axios({ - url: undefined, - })).toThrowError(/Provided config url is not valid/); - done(); - - expect(() => axios({ - method: 'POST', - })).toThrowError(/Provided config url is not valid/); - done(); - }); - it('should treat single string arg as url', function (done) { axios('/foo');