mirror of https://github.com/tiangolo/fastapi.git
Merge 7f75484998 into 272204c0c7
This commit is contained in:
commit
679f455735
|
|
@ -96,7 +96,7 @@ def request_response(
|
||||||
async def app(scope: Scope, receive: Receive, send: Send) -> None:
|
async def app(scope: Scope, receive: Receive, send: Send) -> None:
|
||||||
request = Request(scope, receive, send)
|
request = Request(scope, receive, send)
|
||||||
|
|
||||||
async def app(scope: Scope, receive: Receive, send: Send) -> None:
|
async def inner_app(scope: Scope, receive: Receive, send: Send) -> None:
|
||||||
# Starts customization
|
# Starts customization
|
||||||
response_awaited = False
|
response_awaited = False
|
||||||
async with AsyncExitStack() as request_stack:
|
async with AsyncExitStack() as request_stack:
|
||||||
|
|
@ -117,7 +117,7 @@ def request_response(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Same as in Starlette
|
# Same as in Starlette
|
||||||
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
|
await wrap_app_handling_exceptions(inner_app, request)(scope, receive, send)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ def websocket_session(
|
||||||
async def app(scope: Scope, receive: Receive, send: Send) -> None:
|
async def app(scope: Scope, receive: Receive, send: Send) -> None:
|
||||||
session = WebSocket(scope, receive=receive, send=send)
|
session = WebSocket(scope, receive=receive, send=send)
|
||||||
|
|
||||||
async def app(scope: Scope, receive: Receive, send: Send) -> None:
|
async def inner_app(scope: Scope, receive: Receive, send: Send) -> None:
|
||||||
async with AsyncExitStack() as request_stack:
|
async with AsyncExitStack() as request_stack:
|
||||||
scope["fastapi_inner_astack"] = request_stack
|
scope["fastapi_inner_astack"] = request_stack
|
||||||
async with AsyncExitStack() as function_stack:
|
async with AsyncExitStack() as function_stack:
|
||||||
|
|
@ -143,7 +143,7 @@ def websocket_session(
|
||||||
await func(session)
|
await func(session)
|
||||||
|
|
||||||
# Same as in Starlette
|
# Same as in Starlette
|
||||||
await wrap_app_handling_exceptions(app, session)(scope, receive, send)
|
await wrap_app_handling_exceptions(inner_app, session)(scope, receive, send)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue