Closed
Description
Problem
It's stated in the doc that sock_timeout
for aiohttp.web.StreamResponse
limits delay between chunks. So I think the following test should be passed:
async def test_read_timeout_between_chunks(aiohttp_client) -> None:
async def handler(request):
resp = aiohttp.web.StreamResponse()
await resp.prepare(request)
for _ in range(4):
await asyncio.sleep(0.1)
await resp.write(b'data\n')
return resp
app = web.Application()
app.add_routes([web.get('/', handler)])
timeout = aiohttp.ClientTimeout(sock_read=0.2)
client = await aiohttp_client(app, timeout=timeout)
res = b''
async with await client.get('/') as resp:
res += await resp.read()
assert res == b'data\n' * 4
However now it's failing with ServerTimeoutError
. sock_read
is the de facto timeout for all readings from aiohttp.web.StreamResponse
.
Your environment
Fedora 30, x86_64 Linux 5.0.17-300.fc30.x86_64
python: 3.7.4
aiohttp: v3.6.0 (b33540c)
Metadata
Assignees
Labels
No labels