Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@tiangolo
Copy link
Member

@tiangolo tiangolo commented Sep 21, 2025

🐛 Fix support for StreamingResponses with dependencies with yield or UploadFiles, close after the response is done


There's (again) an AsyncExitStack middleware, now used mainly to close objects after the response is done.

There's also a new wrapper duplicating some logic in Starlette but creating an AsyncExitStack for the exit code in dependencies with yield, for regular responses and WebSockets as well.

The exit code of dependencies with yield is now executed after the response is done.

tiangolo and others added 19 commits September 3, 2025 17:26
…tion`) in dependencies with `yield` in the exit code, do not support them in background tasks (#10831)"

This reverts commit a4aa79e.
@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

@tiangolo tiangolo added the bug Something isn't working label Sep 21, 2025
@github-actions
Copy link
Contributor

@tiangolo tiangolo marked this pull request as ready for review September 21, 2025 18:58
@tiangolo tiangolo changed the title 🐛 Fix support for streaming responses with dependencies with yield, close after the response is done 🐛 Fix support for StreamingResponses with dependencies with yield or UploadFiles, close after the response is done Sep 21, 2025
@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

@tiangolo tiangolo merged commit e329d78 into master Sep 29, 2025
53 of 54 checks passed
@tiangolo tiangolo deleted the yield branch September 29, 2025 03:29
nilslindemann added a commit to nilslindemann/fastapi that referenced this pull request Oct 1, 2025
YuriiMotov added a commit that referenced this pull request Oct 1, 2025
* Sync German docs with #13917

Plus a typo fix in tutorial/security/oauth2-jwt.md line 89.

* Sync german docs with #14099

---------

Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
@anton-ryzhov
Copy link

This PR also fixes #12508

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.