-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Closed
Description
Describe the bug
Since I upgrade axios from 0.18.0 to 0.19.0, the requests made to fetch a local file (file:///
) with a relative path return an error: Request failed with status code 0
. However the web browser will always return a status code 0 when the request success because there is no HTTP server involved. The XHR readyState is also 4, if there was a network error, I believe this one would probably be 0 as well.
To Reproduce
// In a HTML file like opened at file:///tmp/axios.html for example
axios.get('./file.ttf', {
responseType: 'arraybuffer',
}).then((resp) => {
console.log('OK', resp);
}).catch((err) => {
if (err.request && err.request.readyState === 4) {
// The response here should not be treated as an error
}
console.log('ERR', err);
});
Expected behavior
The request should success and return the arraybuffer (works with axios 0.18.0).
Environment:
- Axios Version: 0.19.0
- OS: iOS 12.4, OSX 10.14.6
- Browser: Safari
- Browser Version: 12.1.2
- Additional Library Versions: None
dankuck and nsnds
Metadata
Metadata
Assignees
Labels
No labels