This commit is contained in:
Timothy Jaeryang Baek committed 2026-04-14 01:17:39 -05:00
1 parent cced77b584
commit 37658fd541
2 files changed
+16 -4

No files matched your search

+8 -2
View File
@@ -93,10 +93,16 @@ async def cleanup_response(
"""
if response:
if not response.closed:
await response.close()
# aiohttp 3.9+ made ClientResponse.close() synchronous (returns None).
# Older versions returned a coroutine. Handle both gracefully.
result = response.close()
if result is not None:
await result
if session:
if not session.closed:
await session.close()
result = session.close()
if result is not None:
await result
async def stream_wrapper(response, session=None, content_handler=None):