Response.json try to parse even empty body
#565
Answered
by
0x676e67
somespecialone
asked this question in
Q&A
|
If response has r = await Client().get("...") # empty body
await r.json()Becomes this: Is it intentional? |
Answered by
0x676e67
Apr 13, 2026
Replies: 2 comments 4 replies
|
This is the error thrown by the upstream library, and it should behave in a consistent manner with reqwest. https://github.com/seanmonstar/reqwest/blob/1f72916f5cdc30f6cb6c63038c89063795294d50/src/async_impl/response.rs#L270 Give me an example that can be replicated. Maybe there is room for optimization in that case. |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems that only aiohttp likes to return None when parsing an empty body results in an error.