-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Fail fast if no URL is provided #1765
Copy link
Copy link
Closed
Description
Summary
Making a request without URL (config.url being undefined, null or an empty string) is very likely bug in the application using axios. It would help finding these if axios could fail fast (before calling the adapter).
This behavior can only be implemented with request interceptors if it can be ensured that the interceptor containing the check
- is the last one (because other request interceptors may set the URL)
- is not removed before a request is being made.
I'd like to suggest adding the following code in https://github.com/axios/axios/blob/v0.18.0/lib/core/dispatchRequest.js#L57:
if (!config.url) {
return Promise.reject(createError('Missing request URL', config));
}Context
- axios version: 0.17.1
- Environment: any
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels