馃悶 Describe the bug
TraceConfig.on_response_chunk_received doesn't trace if the response body is read from ClientResponse.content
This behavior isn't obvious when looking at Tracing Reference, Streaming Response Content, ClientResponse.content
馃挕 To Reproduce
# test.py
import aiohttp
import asyncio
URL = 'https://raw.githubusercontent.com/aio-libs/aiohttp/master/docs/_static/aiohttp-icon-128x128.png'
async def cb(session, context, params):
print('cb received', len(params.chunk), 'bytes')
async def main():
tc = aiohttp.TraceConfig()
tc.on_response_chunk_received.append(cb)
async with aiohttp.ClientSession(trace_configs=[tc]) as sess:
async with sess.get(URL) as response:
content = await response.content.read()
print('main received', len(content), 'bytes')
# async for chunk in response.content.iter_any():
# print('main received', len(chunk), 'bytes')
asyncio.run(main())
python test.py
main received 4519 bytes
馃挕 Expected behavior
cb received 4519 bytes
main received 4519 bytes
馃搵 Your version of the Python
馃搵 Your version of the aiohttp/yarl/multidict distributions
pip show aiohttp multidict yarl
Name: aiohttp
Version: 3.7.3
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttp
Author: Nikolay Kim
Author-email: fafhrd91@gmail.com
License: Apache 2
Location: /tmp/tmp.HyMrUwIvm8/lib/python3.8/site-packages
Requires: attrs, multidict, typing-extensions, yarl, chardet, async-timeout
Required-by:
---
Name: multidict
Version: 5.1.0
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache 2
Location: /tmp/tmp.HyMrUwIvm8/lib/python3.8/site-packages
Requires:
Required-by: yarl, aiohttp
---
Name: yarl
Version: 1.6.3
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl/
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache 2
Location: /tmp/tmp.HyMrUwIvm8/lib/python3.8/site-packages
Requires: multidict, idna
Required-by: aiohttp
馃悶 Describe the bug
TraceConfig.on_response_chunk_receiveddoesn't trace if the response body is read fromClientResponse.contentThis behavior isn't obvious when looking at Tracing Reference, Streaming Response Content, ClientResponse.content
馃挕 To Reproduce
馃挕 Expected behavior
馃搵 Your version of the Python
馃搵 Your version of the aiohttp/yarl/multidict distributions