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
Decode error #5336
Comments
Add axios.defaults.headers['Accept-Encoding'] = 'identity'; But, did it change suddenly? |
👍 |
Simpler example that doesn’t require any authorization tokens: require('axios').get('https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&format=json').then(r => console.log(r.data)); Standard MediaWiki API request. Logs proper JSON with axios 1.1.3 but garbled nonsense with axios 1.2.0. |
Okay, I found the bug. The new code in #5250: - if (data && data.length === 0 && res.headers['content-encoding']) {
+ if ((!responseLength || res.statusCode === 204) && res.headers['content-encoding']) { requires that the |
Though I think the old code was buggy too, just in a way that didn’t come up as often – |
you can do the correction update yes. |
1.2.1 has the fix |
Please try 1.2.1 if that does not work please open a new issue and mention me. |
Seems like I still sometimes get this error randomly |
after the update here it was normal, there was no problem. |
Describe the bug
I was making a GET request to get an API response, I passed the entire header correctly, Authorization: "Bearer " + Accept: "application/vnd.api+json"
the undecoded response, simply giving me the return 200 but with the json without decode.
The key I provided is temporary, it has a limit of 10 requests per minute.
To Reproduce
https://runkit.com/embed/n960ru9as00a
Code snippet
Expected behavior
the json is returned correctly,
Axios Version
1.2.0
Adapter Version
No response
Browser
Chrome
Browser Version
No response
Node.js Version
v16.17.0
OS
Windows 10
Additional Library Versions
Additional context/Screenshots
The text was updated successfully, but these errors were encountered: