Skip to content

Commit

Permalink
Add a empty header value parsing test (failing test)
Browse files Browse the repository at this point in the history
  • Loading branch information
popravich committed Aug 27, 2018
1 parent 2f97bf0 commit 3e12a2c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_client_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,26 @@ async def handler(request):
resp.close()


async def test_empty_header_values(aiohttp_client):
async def handler(request):
resp = web.Response()
resp.headers['X-Empty'] = ''
return resp

app = web.Application()
app.router.add_route('GET', '/', handler)
client = await aiohttp_client(app)
resp = await client.get('/')
assert resp.status == 200
raw_headers = tuple((bytes(h), bytes(v)) for h, v in resp.raw_headers)
assert raw_headers == ((b'X-Empty', b''),
(b'Content-Length', b'0'),
(b'Content-Type', b'application/octet-stream'),
(b'Date', mock.ANY),
(b'Server', mock.ANY))
resp.close()


async def test_204_with_gzipped_content_encoding(aiohttp_client):
async def handler(request):
resp = web.StreamResponse(status=204)
Expand Down

0 comments on commit 3e12a2c

Please sign in to comment.