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
Parse empty response bodies without throwing #415
Comments
I will try to fix it and raise a PR asap. |
PR created: #416 |
202 may have a response body[1]. An empty string is not valid JSON. [1] https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.3
|
Ok, I’m in that situation when 202 doesn’t have a response. What do you think it’s the solution as the library crashes right now? |
You can either try/catch but a better solution would be to manually parse this. |
We already special case 204 responses. Should probably do the same here for consistency, IMO. |
Then maybe let's do so for all |
Yeah, I guess that's fair. I was thinking in terms of whether it's reasonable for a given status code to have an empty body. But I'm sure there are plenty of implementations out there that return an empty body with a 200 or other success codes. Maybe we should just allow that for convenience sake. |
@sholladay That should definitely be allowed and handled inside ky. For instance |
Hello guys! Would love to work on this issue if possible, but I just wanted to confirm if I understood correctly: now we expect that, for any success status code (2xx), if the response body is empty ("invalid") when Is that the expected behavior? 👀 |
I believe, the idea is to check the Also, not sure about an |
When Let's not convert empty objects to |
In case of an 202 there is no way for the HTTP to later send an asynchronous response indicating the outcome of processing the request.
When trying to call the json method we will get Unexpected end of JSON input.
The text was updated successfully, but these errors were encountered: