2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

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
This commit is contained in:
Jay
2022-01-27 08:39:25 +02:00
committed by GitHub
parent 1163588aa2
commit cc86c6c49f
2 changed files with 0 additions and 25 deletions
-7
View File
@@ -36,10 +36,6 @@ Axios.prototype.request = function request(configOrUrl, config) {
config = configOrUrl || {}; config = configOrUrl || {};
} }
if (!config.url) {
throw new Error('Provided config url is not valid');
}
config = mergeConfig(this.defaults, config); config = mergeConfig(this.defaults, config);
// Set config.method // Set config.method
@@ -122,9 +118,6 @@ Axios.prototype.request = function request(configOrUrl, config) {
}; };
Axios.prototype.getUri = function getUri(config) { Axios.prototype.getUri = function getUri(config) {
if (!config.url) {
throw new Error('Provided config url is not valid');
}
config = mergeConfig(this.defaults, config); config = mergeConfig(this.defaults, config);
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
}; };
-18
View File
@@ -7,24 +7,6 @@ describe('requests', function () {
jasmine.Ajax.uninstall(); 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) { it('should treat single string arg as url', function (done) {
axios('/foo'); axios('/foo');