asgi2.py 394 B

123456789101112131415
  1. from uvicorn._types import (
  2. ASGI2Application,
  3. ASGIReceiveCallable,
  4. ASGISendCallable,
  5. Scope,
  6. )
  7. class ASGI2Middleware:
  8. def __init__(self, app: "ASGI2Application"):
  9. self.app = app
  10. async def __call__(self, scope: "Scope", receive: "ASGIReceiveCallable", send: "ASGISendCallable") -> None:
  11. instance = self.app(scope)
  12. await instance(receive, send)