Document synchronous response.write in streaming
The Streaming section of the docs was updated to make clear that a synchronous write should be used in the callback, but this section was not updated.
This commit is contained in:
parent
179606feb1
commit
65ae7669f9
@ -55,8 +55,8 @@ from sanic import response
|
|||||||
@app.route("/streaming")
|
@app.route("/streaming")
|
||||||
async def index(request):
|
async def index(request):
|
||||||
async def streaming_fn(response):
|
async def streaming_fn(response):
|
||||||
await response.write('foo')
|
response.write('foo')
|
||||||
await response.write('bar')
|
response.write('bar')
|
||||||
return response.stream(streaming_fn, content_type='text/plain')
|
return response.stream(streaming_fn, content_type='text/plain')
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user