From: daa Date: Thu, 24 Sep 2020 07:42:26 +0000 (+0300) Subject: Properly close stream on async response close (#1316) X-Git-Tag: 0.15.3~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78afd08e0fc198d05f95728011d1bc7c0c213b30;p=thirdparty%2Fhttpx.git Properly close stream on async response close (#1316) --- diff --git a/httpx/_client.py b/httpx/_client.py index 2fc62c93..553ac760 100644 --- a/httpx/_client.py +++ b/httpx/_client.py @@ -1505,7 +1505,7 @@ class AsyncClient(BaseClient): 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(