Ignore writing headers when in ASGI mode (#1957)

* Ignore writing headers when in ASGI mode for streaming responses

* Move asgi set on streaming until after response type check

* Adds multidict==5.0.0 to pass tests

* Bump version to 20.9.1
This commit is contained in:
Adam Hopkins
2020-10-25 15:01:53 +02:00
committed by GitHub
parent 9e048bc0c3
commit e5aed4c067
5 changed files with 36 additions and 12 deletions

View File

@@ -7,8 +7,8 @@
"""
from pathlib import Path
from sanic import Sanic, response
from sanic import Sanic, response
app = Sanic(__name__)
@@ -42,9 +42,7 @@ async def handler_file(request):
@app.route("/file_stream")
async def handler_file_stream(request):
return await response.file_stream(
Path("../") / "setup.py", chunk_size=1024
)
return await response.file_stream(Path("../") / "setup.py", chunk_size=1024)
@app.route("/stream", stream=True)