]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Properly close stream on async response close (#1316)
authordaa <aduryagin@gmail.com>
Thu, 24 Sep 2020 07:42:26 +0000 (10:42 +0300)
committerGitHub <noreply@github.com>
Thu, 24 Sep 2020 07:42:26 +0000 (09:42 +0200)
httpx/_client.py

index 2fc62c935a8c88b6ad17f64296fb8922b5632354..553ac7609a975822a56bc29258078fd41346f493 100644 (file)
@@ -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(