-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fails to parse JSON, doesn't give us the raw response. #675
Comments
Yeah, I am having the same problem. Actually superagent checks the |
Same issue here. Response from API is plain text but the header is |
There should be some option to get the raw response text in case the JSON parsing fails ? |
I added a |
@reinaldo13 Great ! |
I had the same problem, content-type is application/json but failed to parse,then it warned double callback! |
- Added rawResponse property to error object on the server side
Same here; I'm purposefully sending back malformed JSON (as that's what numerous Google scripts do to stop people injecting the resource directly onto a apage in a A way to either disable the auto-parsing, or, somehow get the response in the error would allow me to skirt around this problem. |
#716 added |
It'll certainly give a workaround for examining the error and seeing if it "really" is an error. Having some way to disable the auto-parsing sounds like it'd be pretty useful but perhaps the use cases for this functionality are too small. Do you know when this PR will be included into a release or SuperAgent that could be pulled over NPM? When's your next release? |
I'll be released soon |
For particular reasons, the response from the server is a malformed JSON string, ie: it will fail to parse.
However we'd still like to show the raw body content but can't because superagent doesn't include that data.
Can we have the err callback included the raw response.
Round about here I think...
https://github.com/visionmedia/superagent/blob/master/lib/client.js#L466-L473
The text was updated successfully, but these errors were encountered: