httpx icon indicating copy to clipboard operation
httpx copied to clipboard

Ensure mounted transports are closed even if main transport raises

Open bysiber opened this issue 9 months ago • 0 comments

When closing a client with proxy mounts, if the main transport's close()/__exit__() raises an exception, the mounted proxy transports would never be cleaned up. This wraps transport cleanup in try/finally to ensure all transports are properly closed.

Affects Client.close(), Client.__exit__(), AsyncClient.aclose(), and AsyncClient.__aexit__().

bysiber avatar Feb 20 '26 00:02 bysiber