diff --git a/docs/index.md b/docs/index.md index d5f40c23..ed40fb22 100644 --- a/docs/index.md +++ b/docs/index.md @@ -104,7 +104,7 @@ class App: async def __call__(self, receive, send): response = PlainTextResponse('Hello, world!') - await response(receive, send) + await response(self.scope, receive, send) ``` Run the `App` application in `example.py`: diff --git a/docs/requests.md b/docs/requests.md index 608caba7..e432793a 100644 --- a/docs/requests.md +++ b/docs/requests.md @@ -20,7 +20,7 @@ class App: request = Request(self.scope, receive) content = '%s %s' % (request.method, request.url.path) response = Response(content, media_type='text/plain') - await response(receive, send) + await response(self.scope, receive, send) ``` Requests present a mapping interface, so you can use them in the same @@ -105,7 +105,7 @@ class App: async for chunk in request.stream(): body += chunk response = Response(body, media_type='text/plain') - await response(receive, send) + await response(self.scope, receive, send) ``` If you access `.stream()` then the byte chunks are provided without storing diff --git a/docs/responses.md b/docs/responses.md index 9aaf24e1..91a5734f 100644 --- a/docs/responses.md +++ b/docs/responses.md @@ -29,7 +29,7 @@ class App: async def __call__(self, receive, send): response = Response('Hello, world!', media_type='text/plain') - await response(receive, send) + await response(self.scope, receive, send) ``` #### Set Cookie @@ -68,7 +68,7 @@ class App: async def __call__(self, receive, send): response = HTMLResponse('

Hello, world!

') - await response(receive, send) + await response(self.scope, receive, send) ``` ### PlainTextResponse @@ -86,7 +86,7 @@ class App: async def __call__(self, receive, send): response = PlainTextResponse('Hello, world!') - await response(receive, send) + await response(self.scope, receive, send) ``` ### JSONResponse @@ -104,7 +104,7 @@ class App: async def __call__(self, receive, send): response = JSONResponse({'hello': 'world'}) - await response(receive, send) + await response(self.scope, receive, send) ``` ### UJSONResponse @@ -128,7 +128,7 @@ class App: async def __call__(self, receive, send): response = UJSONResponse({'hello': 'world'}) - await response(receive, send) + await response(self.scope, receive, send) ``` ### RedirectResponse @@ -149,7 +149,7 @@ class App: response = RedirectResponse(url='/') else: response = PlainTextResponse('Hello, world!') - await response(receive, send) + await response(self.scope, receive, send) ``` ### StreamingResponse @@ -177,7 +177,7 @@ class App: async def __call__(self, receive, send): generator = slow_numbers(1, 10) response = StreamingResponse(generator, media_type='text/html') - await response(receive, send) + await response(self.scope, receive, send) ``` Have in mind that file-like objects (like those created by `open()`) are normal iterators. So, you can return them directly in a `StreamingResponse`. @@ -206,5 +206,5 @@ class App: async def __call__(self, receive, send): response = FileResponse('statics/favicon.ico') - await response(receive, send) + await response(self.scope, receive, send) ``` diff --git a/docs/testclient.md b/docs/testclient.md index 6065e4d0..97a39a60 100644 --- a/docs/testclient.md +++ b/docs/testclient.md @@ -14,7 +14,7 @@ class App: async def __call__(self, receive, send): response = HTMLResponse('Hello, world!') - await response(receive, send) + await response(self.scope, receive, send) def test_app():