New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting local files (file://) fail after upgrading from 0.18.0 to 0.19.0 #2416
Comments
Alanscut
added a commit
to Alanscut/axios
that referenced
this issue
Oct 17, 2019
Alanscut
added a commit
to Alanscut/axios
that referenced
this issue
Oct 17, 2019
The success status code of the file:// protocol is 0, and the default success status code of axios is 200~300. You can customize the validateStatus function to change the success status code to access the local file. validateStatus: function (status) {
return status ===0 || (status >= 200 && status < 300);
} |
Alanscut
added a commit
to Alanscut/axios
that referenced
this issue
Oct 18, 2019
Closed
chinesedfan
pushed a commit
that referenced
this issue
Mar 23, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
When using axios to get a local file (
file://...
) I get status code 0 as if there's a CORS issue. This didn't happen using version 0.18.0 so I assume that this is a bug?To Reproduce
Get a local file. In my case I wanted to get a PDF as an array buffer.
Expected behavior
Just like in version 0.18.0 version I should get a 200 response.
Environment:
Additional context/Screenshots
Need to build and run index.html locally so you're making the request from file:// as well.
The text was updated successfully, but these errors were encountered: