Any reason call_next definition has been moved inside of __call__ in BaseHTTPMiddleware? #1538
-
Before anyio integration update starlette/starlette/middleware/base.py Line 28 in ea19904 we had some use-cases for this as it made it straigtforward to customize the request type a little bit by simply overriding the class CustomBaseHTTPMiddleware:
def __init__(self, app: ASGIApp, dispatch: DispatchFunction = None) -> None:
self.app = app
self.dispatch_func = self.dispatch if dispatch is None else dispatch
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
if scope["type"] != "http":
await self.app(scope, receive, send)
return
request = CustomRequest(scope, receive=receive)
response = await self.dispatch_func(request, self.call_next)
await response(scope, receive, send) since the anyio stuff starlette/starlette/middleware/base.py Line 25 in 813aa8d Is there any particular reason for this change? I couldn't see it discussed anywhere in the pr for the anyio changes... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I guess it is because we needed this line: starlette/starlette/middleware/base.py Line 38 in 813aa8d |
Beta Was this translation helpful? Give feedback.
I guess it is because we needed this line:
starlette/starlette/middleware/base.py
Line 38 in 813aa8d