-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
error.response.data is being a string when the data is JSON #797
Comments
It happens for me only if response is not valid json. So I advice you recheck your server response. |
You are likely getting a string response because you're converting the error into a string type by concatenating it with the "!". |
On Axios 0.18 say Uncaught (in promise) TypeError: error.response.data.errors.map is not a function |
I'm seeing it as well, and am not modifying the response in the catch block.
From response headers: From package.json: |
I actually somehow go around that like a few days ago of posting this issue. I feel extremely guilty for not posting the solution here. In fact, I don't remember what I have done to make it work. 🤷♂️ |
Is it for certain status codes only? It's happening on a 401 error for me, where I would like to parse the response. |
Seems @MicroDroid has solved his problem. For others, feel free to open a new issue if it is still there. |
Identical to #378
I'm using Axios version 0.15.3.
After my function failing, I added a
console.log
:and in the console, I'm getting this:
Which is purely a string and not an object, as accessing any of the field results in
undefined
oh, and the function is used like:
The text was updated successfully, but these errors were encountered: