Browse Source

Merge 7f75484998 into 460f8d2cc8

pull/14476/merge
Ishan Surdi 13 hours ago
committed by GitHub
parent
commit
5d9df8d6df
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      fastapi/routing.py

8
fastapi/routing.py

@ -110,7 +110,7 @@ def request_response(
async def app(scope: Scope, receive: Receive, send: Send) -> None:
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
response_awaited = False
async with AsyncExitStack() as request_stack:
@ -131,7 +131,7 @@ def request_response(
)
# 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
@ -149,7 +149,7 @@ def websocket_session(
async def app(scope: Scope, receive: Receive, send: Send) -> None:
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:
scope["fastapi_inner_astack"] = request_stack
async with AsyncExitStack() as function_stack:
@ -157,7 +157,7 @@ def websocket_session(
await func(session)
# 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

Loading…
Cancel
Save