-
-
Notifications
You must be signed in to change notification settings - Fork 840
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
Fix exception suppression in asgi transport #2669
Conversation
async with httpx.AsyncClient(app=raise_exc, transport=transport) as client: | ||
response = await client.get("http://www.example.org/") | ||
|
||
assert response.status_code == 500 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the behaviour of this test before the code change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test failed with RuntimeError
being raised from raise_exc
Co-authored-by: Tom Christie <tom@tomchristie.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable, yup.
Okay, let's also add this to the
Perhaps? |
Bug description:
If httpx client uses asgi transport with
raise_app_exceptions=False
and response is not complete, exception is still raised.This is mostly come up in tests where you want to check how your application behave in error states. But currently it works only with non-streaming responses, which is quite limiting.
I propose simple fix for such non-complete responses to be able to comply with the
raise_app_exceptions=False
.Test case included.