From 2714f32238077fa5975531c76b816ca07ba10861 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 27 Feb 2020 20:41:28 +0000 Subject: [PATCH] Close proxy dispatch classes on Client.close() (#826) --- httpx/_client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/httpx/_client.py b/httpx/_client.py index 472d455953..7401a36fff 100644 --- a/httpx/_client.py +++ b/httpx/_client.py @@ -862,6 +862,8 @@ def delete( def close(self) -> None: self.dispatch.close() + for proxy in self.proxies.values(): + proxy.close() def __enter__(self) -> "Client": return self @@ -1388,6 +1390,8 @@ async def delete( async def aclose(self) -> None: await self.dispatch.close() + for proxy in self.proxies.values(): + await proxy.close() async def __aenter__(self) -> "AsyncClient": return self