Skip to content
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

Don't poll for disconnects in BaseHTTPMiddleware via StreamingResponse #2620

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

adriangb
Copy link
Member

Fixes #2516

@mikkelduif
Copy link
Contributor

I can confirm that this PR fixes the example I have reproduced in #2516 (comment)

@adriangb adriangb requested a review from Kludex June 13, 2024 20:57
@mikkelduif
Copy link
Contributor

I do still recommend you avoid BaseHTTPMiddleware

Maybe we should consider to add a section to: https://www.starlette.io/middleware/#basehttpmiddleware emphasising this.
I do not know the exact technicalities for this, however, it might help future users to avoid it.

@adriangb
Copy link
Member Author

adriangb commented Jun 14, 2024

Seems like the issue now is coverage in tests (all of the tests still pass). There are several pieces of test code that are not not being hit but I'm not sure if they were essential or just an implementation detail, some more careful evaluation is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RuntimeError("No response returned") in BaseHTTPMiddleware
2 participants