Skip to content

Commit

Permalink
Properly close stream on async response close (#1316)
Browse files Browse the repository at this point in the history
  • Loading branch information
daa committed Sep 24, 2020
1 parent 8ceb34f commit 78afd08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion httpx/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ async def _send_single_request(

async def on_close(response: Response) -> None:
response.elapsed = datetime.timedelta(seconds=await timer.async_elapsed())
if hasattr(stream, "close"):
if hasattr(stream, "aclose"):
await stream.aclose()

response = Response(
Expand Down

0 comments on commit 78afd08

Please sign in to comment.