7 Commits

Author SHA1 Message Date
Motov Yurii dc3278654f 📝 Use WSGIMiddleware from a2wsgi instead of deprecated fastapi.middleware.wsgi.WSGIMiddleware (#14756)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-02-04 12:54:23 +01:00
Sebastián Ramírez e329d78f86 🐛 Fix support for StreamingResponses with dependencies with yield or UploadFiles, close after the response is done (#14099)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-29 05:29:38 +02:00
Sebastián Ramírez a4aa79e0b4 ✨ Add support for raising exceptions (including HTTPException) in dependencies with yield in the exit code, do not support them in background tasks (#10831)
* ♻️ Refactor dependency AsyncExitStack logic, exit dependencies after creating the response, before sending it

* ✅ Update tests for dependencies exit, check they are finished before the response is sent

* 🔥 Remove ExitAsyncStackMiddleware as it's no longer needed

* 📝 Update docs for dependencies with yield

* 📝 Update release notes

* 📝 Add source examples for new dependencies with yield raising

* ✅ Add tests for new dependencies raising after yield

* 📝 Update release notes
2023-12-25 18:57:35 +01:00
Sebastián Ramírez 17e49bc9f7 ♻️ Simplify AsyncExitStackMiddleware as without Python 3.6 AsyncExitStack is always available (#9657)
♻️ Simplify AsyncExitStackMiddleware as without Python 3.6 AsyncExitStack is always available
2023-06-11 21:49:18 +00:00
Sebastián Ramírez 9d56a3cb59 ✨ Update internal AsyncExitStack to fix context for dependencies with yield (#4575) 2022-02-17 13:40:12 +01:00
Sebastián Ramírez fdb6c9ccc5 ✨ Improve type annotations, add support for mypy --strict, internally and for external packages (#2547) 2020-12-20 19:50:00 +01:00
Sebastián Ramírez 0ac9b3ee5c ✨ Re-export utils from Starlette (#1064)
* ✨ Re-export main features used from Starlette to simplify developer's code

* ♻️ Refactor Starlette exports

* ♻️ Refactor tutorial examples to use re-exported utils from Starlette

* 📝 Add examples for all middlewares

* 📝 Add new docs for middlewares

* 📝 Add examples for custom responses

* 📝 Extend docs for custom responses

* 📝 Update docs and add notes explaining re-exports from Starlette everywhere

* 🍱 Update screenshot for HTTP status

* 🔧 Update MkDocs config with new content

* ♻️ Refactor tests to use re-exported utils from Starlette

* ✨ Re-export WebSocketDisconnect from Starlette for tests

* ✅ Add extra tests for extra re-exported middleware

* ✅ Add tests for re-exported responses from Starlette

* ✨ Add docs about mounting WSGI apps

* ➕ Add Flask as a dependency to test WSGIMiddleware

* ✅ Test WSGIMiddleware example
2020-03-01 21:49:20 +01:00