-
-
Notifications
You must be signed in to change notification settings - Fork 926
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
Handle empty response (204) #78
Handle empty response (204) #78
Conversation
Technically - blank response (at least with http://stackoverflow.com/questions/11970962/valid-json-in-response |
The situation I hit this with was on a 204 response. I started this PR only Thoughts?
|
@connyay I think it is expected behaviour never less empty string is invalid JSON. request is behaving something like this. @sindresorhus what do you think? |
I'm not sure tbh. Empty response on 200 is invalid, so we shouldn't do anything there. 204 is valid with blank response, so we should maybe handle that somehow (suggestions?). Maybe we should only try to parse JSON when content-type is "application/json"? I assume servers don't send that on 204?. |
@sindresorhus a lot of endpoints do not send @connyay could you do a 204 check instead? Related: ladjs/superagent#255 |
@floatdrop switched to check for 204 |
@connyay cool! Can you squash it into one commit? |
d30d74a
to
3864556
Compare
3864556
to
312c80d
Compare
@floatdrop should be good. 🍻 |
🍻 |
No description provided.