diff --git a/fastapi/routing.py b/fastapi/routing.py index 78207778a..0a971f98b 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -127,7 +127,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: @@ -148,7 +148,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 @@ -166,7 +166,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: @@ -174,7 +174,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