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:
@@ -235,6 +235,12 @@ def test_chunked_streaming_returns_correct_content(streaming_app):
|
||||
assert response.text == "foo,bar"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_chunked_streaming_returns_correct_content_asgi(streaming_app):
|
||||
request, response = await streaming_app.asgi_client.get("/")
|
||||
assert response.text == "4\r\nfoo,\r\n3\r\nbar\r\n0\r\n\r\n"
|
||||
|
||||
|
||||
def test_non_chunked_streaming_adds_correct_headers(non_chunked_streaming_app):
|
||||
request, response = non_chunked_streaming_app.test_client.get("/")
|
||||
assert "Transfer-Encoding" not in response.headers
|
||||
@@ -242,6 +248,16 @@ def test_non_chunked_streaming_adds_correct_headers(non_chunked_streaming_app):
|
||||
assert response.headers["Content-Length"] == "7"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_non_chunked_streaming_adds_correct_headers_asgi(
|
||||
non_chunked_streaming_app,
|
||||
):
|
||||
request, response = await non_chunked_streaming_app.asgi_client.get("/")
|
||||
assert "Transfer-Encoding" not in response.headers
|
||||
assert response.headers["Content-Type"] == "text/csv"
|
||||
assert response.headers["Content-Length"] == "7"
|
||||
|
||||
|
||||
def test_non_chunked_streaming_returns_correct_content(
|
||||
non_chunked_streaming_app,
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user