]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
Remove 'set_receive_channel' method
authorTom Christie <tom@tomchristie.com>
Tue, 26 Jun 2018 10:10:54 +0000 (11:10 +0100)
committerTom Christie <tom@tomchristie.com>
Tue, 26 Jun 2018 10:10:54 +0000 (11:10 +0100)
README.md
starlette/decorators.py
starlette/request.py

index a8fb92f5c2bbe093232dfe8cc75dd1c55ffcc08a..efc35046d52a52913b4685614afdfcae92eafc6e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -171,6 +171,9 @@ way as a `scope`.
 
 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`.
index 6c7969b073c430d3acd8435fff7ac5f5a49086fa..8c575315716ad59b1153d93d55b39ca1880a25af 100644 (file)
@@ -5,10 +5,8 @@ from starlette.types import ASGIInstance, Receive, Send, Scope
 
 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)
 
index b677beeaaff006ea745fc26748c5f890d7d5f9ad..de881a02d273d2f281e14d300048f7e5742b9197 100644 (file)
@@ -19,9 +19,6 @@ class Request(Mapping):
     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"]