From cc86c6c49fdbfd8e2517b191b8833d2f2816ff91 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 27 Jan 2022 08:39:25 +0200 Subject: [PATCH] Fix/remove url required (#4426) * Removed error when url is null as this breaks current use cases for alot of projects * Removed associated tests that check for the for url to not be empty --- lib/core/Axios.js | 7 ------- test/specs/requests.spec.js | 18 ------------------ 2 files changed, 25 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(/^\?/, ''); }; 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');