diff --git a/tests/test_client_functional.py b/tests/test_client_functional.py index 1de8aaec67c..c1a5c31c843 100644 --- a/tests/test_client_functional.py +++ b/tests/test_client_functional.py @@ -1796,6 +1796,26 @@ async def handler(request): resp.close() +async def test_payload_content_length_by_chunks(loop, test_client): + + async def handler(request): + resp = web.StreamResponse(headers={'content-length': '3'}) + await resp.prepare(request) + await resp.write(b'answer') + await resp.write(b'') + request.transport.close() + return resp + + app = web.Application() + app.router.add_get('/', handler) + client = await test_client(app) + + resp = await client.get('/') + data = await resp.read() + assert data == b'ans' + resp.close() + + async def test_chunked(loop, test_client): async def handler(request):