Skip to content

Patch httpx transports instead of httpcore#972

Open
seowalex wants to merge 2 commits intokevin1024:masterfrom
seowalex:master
Open

Patch httpx transports instead of httpcore#972
seowalex wants to merge 2 commits intokevin1024:masterfrom
seowalex:master

Conversation

@seowalex
Copy link
Contributor

@seowalex seowalex commented Jan 10, 2026

While #943 brings a lot of advantages by moving the patch target to a lower level, it inadvertently broke the use of custom transports that do not wrap the default transports (see #968). To ensure that both entirely custom transports and custom transports that wrap the default transports work with VCR.py, we change the patch target to the transport level instead.

This necessitates wrapping each transport that HTTPX supports, such as HTTPTransport, AyncHTTPTransport, WSGITransport, ASGITransport and MockTransport. I have also added support for CurlTransport and AsyncCurlTransport from https://github.com/vgavro/httpx-curl-cffi, which seems to be the only popular alternative transport I can find on GitHub.

This also fixes a bug found in #977 causing the connection pool to be exhausted due to not properly closing the original response stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant