|
@ -1019,10 +1019,8 @@ class FastAPI(Starlette): |
|
|
# streaming responses while keeping compatibility with the previous |
|
|
# streaming responses while keeping compatibility with the previous |
|
|
# versions (as of writing 0.117.1) that allowed doing |
|
|
# versions (as of writing 0.117.1) that allowed doing |
|
|
# except HTTPException inside a dependency with yield. |
|
|
# except HTTPException inside a dependency with yield. |
|
|
|
|
|
|
|
|
# This needs to happen after user middlewares because those create a |
|
|
# This needs to happen after user middlewares because those create a |
|
|
# new contextvars context copy by using a new AnyIO task group. |
|
|
# new contextvars context copy by using a new AnyIO task group. |
|
|
|
|
|
|
|
|
# This AsyncExitStack preserves the context for contextvars, not |
|
|
# This AsyncExitStack preserves the context for contextvars, not |
|
|
# strictly necessary for closing files but it was one of the original |
|
|
# strictly necessary for closing files but it was one of the original |
|
|
# intentions. |
|
|
# intentions. |
|
@ -1030,7 +1028,6 @@ class FastAPI(Starlette): |
|
|
# contextvars were set, for example in a dependency with 'yield' |
|
|
# contextvars were set, for example in a dependency with 'yield' |
|
|
# in that internal contextvars context, the values would not be |
|
|
# in that internal contextvars context, the values would not be |
|
|
# available in the outer context of the AsyncExitStack. |
|
|
# available in the outer context of the AsyncExitStack. |
|
|
|
|
|
|
|
|
# By placing the middleware and the AsyncExitStack here, inside all |
|
|
# By placing the middleware and the AsyncExitStack here, inside all |
|
|
# user middlewares, the same context is used. |
|
|
# user middlewares, the same context is used. |
|
|
# This is currently not needed, only for closing files, but used to be |
|
|
# This is currently not needed, only for closing files, but used to be |
|
|