Handle empty response (204)#78
Conversation
|
Technically - blank response (at least with |
|
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: forwardemail/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.