Skip to content

Commit

Permalink
reproduce test
Browse files Browse the repository at this point in the history
  • Loading branch information
derlih committed Oct 24, 2020
1 parent 4cbd52c commit 460faa9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_web_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import aiohttp
from aiohttp import FormData, HttpVersion10, HttpVersion11, TraceConfig, multipart, web
from aiohttp.hdrs import CONTENT_LENGTH, TRANSFER_ENCODING
from aiohttp.test_utils import make_mocked_coro

try:
Expand Down Expand Up @@ -1879,3 +1880,20 @@ async def handler(request):
resp = await client.post("/", data=b"data")
assert resp.status == 200
assert await resp.text() == "data (2, 4)"


@pytest.mark.parametrize(
"status", [101, 204],
)
async def test_response_101_204_no_content_length_http11(
status, aiohttp_client
) -> None:
async def handler(_):
return web.Response(status=status)

app = web.Application()
app.router.add_get("/", handler)
client = await aiohttp_client(app, version="1.1")
resp = await client.get("/")
assert CONTENT_LENGTH not in resp.headers
assert TRANSFER_ENCODING not in resp.headers

0 comments on commit 460faa9

Please sign in to comment.