For instance: `request['path']` will return the ASGI path.
+If you don't need to access the request body you can instantiate a request
+without providing an argument to `receive`.
+
#### Method
The request method is accessed as `request.method`.
def asgi_application(func):
def app(scope: Scope) -> ASGIInstance:
- request = Request(scope)
-
async def awaitable(receive: Receive, send: Send) -> None:
- request.set_receive_channel(receive)
+ request = Request(scope, receive)
response = func(request)
await response(receive, send)
def __len__(self):
return len(self._scope)
- def set_receive_channel(self, receive):
- self._receive = receive
-
@property
def method(self) -> str:
return self._scope["method"]