Response.json try to parse even empty body
#565
-
|
If response has r = await Client().get("...") # empty body
await r.json()Becomes this: Is it intentional? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 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. |
Beta Was this translation helpful? Give feedback.
It seems that only aiohttp likes to return None when parsing an empty body results in an error.