Make the response's request parameter optional#1238
Make the response's request parameter optional#1238lovelydinosaur merged 9 commits intoencode:masterfrom
Conversation
|
Okay, so it turns out this issue is actually more awkawrd than realised at first, because although we do want Here's what I think we're going to need to do here...
That'll allow us to have...
You're welcome to take on these follow ups yourself, or else I'd also be happy to take a look at them. |
|
Thanks for the detailed guidance. |
httpx/_models.py
Outdated
| if self._request is None: | ||
| raise ValueError(message) | ||
| raise HTTPStatusError(message, request=self._request, response=self) |
There was a problem hiding this comment.
Raising a ValueError inside raise_for_status seems a bit off ?
There was a problem hiding this comment.
I'd suggest we start the method with something like...
if self._request is None:
raise RuntimeError("Cannot call `raise_for_status` as the request instance has not been set on this response.")
lovelydinosaur
left a comment
There was a problem hiding this comment.
Great, yup! Thanks so much for your time on this!
I've added in a _wrap_decode_errors context manager, to remove some of the replication, and get the test coverage back up to 100%
Make the response's request parameter optional
Part of #1227