Skip to content

Commit

Permalink
Fix/remove url required (#4426)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jasonsaayman committed Jan 27, 2022
1 parent 1163588 commit cc86c6c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
7 changes: 0 additions & 7 deletions lib/core/Axios.js
Expand Up @@ -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
Expand Down Expand Up @@ -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(/^\?/, '');
};
Expand Down
18 changes: 0 additions & 18 deletions test/specs/requests.spec.js
Expand Up @@ -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');

Expand Down

0 comments on commit cc86c6c

Please sign in to comment.