Providing content encoding for UnexpectedResponse errors. #948
Replies: 1 comment
-
An arbitrary response is not guaranteed to contain text in the body, so calling So really, without prior knowledge of what the response from the API is going to be, you can't know how to or if you can decode into text. I think the "real" answer to this is to expose the |
Beta Was this translation helpful? Give feedback.
-
Summary
Is there a reason why UnexpectedStatus holds response content as
bytes
rather thanstr
? I ask because (in principle)UnexpectedStatus.content
can't be decoded without the encoding, which is provided by the response.If this concern is valid, what change would be warranted? I imagine changing the
UnexpectedStatus.content
field is a breaking change. Could we add another field,UnexpectedStatus.text: str
?Beta Was this translation helpful? Give feedback.
All reactions