# Extension points — encode/httpx

> Canonical page: https://codevetter.com/unpack/httpx/extension-points

# Extension points — encode/httpx

Scanned commit b5addb64f0161ff6bfe94c124ef76f6a1fba5254 (2026-02-23). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Extension is primarily explicit object injection rather than automatic plugin discovery. Transports replace execution, mounts route execution, and Auth generators implement multi-exchange credential behavior. Hooks and extensions add observation and transport-specific metadata without changing the simplified Request/Response model. Internal decoder registries and the CLI option table provide additional edit locations, with public exports checked separately.
- Custom transports subclass BaseTransport.handle_request() or AsyncBaseTransport.handle_async_request(), return Response, and implement close/aclose when they own resources; Client._init_transport() returns an injected transport directly. — [httpx/_transports/base.py#L26-L62](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_transports/base.py#L26-L62) [httpx/_transports/base.py#L65-L86](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_transports/base.py#L65-L86) [httpx/_client.py#L718-L738](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_client.py#L718-L738)
- mounts maps URL patterns to transports or None; explicit entries update proxy-derived mounts, sorting uses URLPattern priority, and the first match selects its transport or falls back to the default for None. — [httpx/_client.py#L698-L716](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_client.py#L698-L716) [httpx/_client.py#L760-L769](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_client.py#L760-L769) [httpx/_utils.py#L192-L223](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_utils.py#L192-L223)
- Auth.auth_flow() is a Request/Response generator protocol supporting multiple exchanges; requires_request_body and requires_response_body trigger buffering, and I/O-bearing schemes can override sync_auth_flow()/async_auth_flow(). — [httpx/_auth.py#L22-L36](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_auth.py#L22-L36) [httpx/_auth.py#L38-L110](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_auth.py#L38-L110)
- Client event_hooks registers lists under request and response, can be changed through the property, and may mutate models. AsyncClient awaits hooks; response hooks needing content must explicitly read or await aread(). — [httpx/_client.py#L262-L270](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_client.py#L262-L270) [httpx/_client.py#L1691-L1697](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_client.py#L1691-L1697) [docs/advanced/event-hooks.md#L33-L65](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/docs/advanced/event-hooks.md#L33-L65)
- Request/Response extensions are an untyped transport-specific channel; the default transport forwards them, documented request keys include timeout and trace, and response network_stream permits lower-level connection access. — [docs/advanced/extensions.md#L3-L5](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/docs/advanced/extensions.md#L3-L5) [docs/advanced/extensions.md#L34-L48](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/docs/advanced/extensions.md#L34-L48) [docs/advanced/extensions.md#L121-L139](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/docs/advanced/extensions.md#L121-L139) [docs/advanced/extensions.md#L204-L216](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/docs/advanced/extensions.md#L204-L216)
- MockTransport injects a Request-to-Response handler, reads the request body before dispatch, and allows async clients to use either sync or coroutine handlers; sync clients reject an async handler result. — [httpx/_transports/mock.py#L8-L43](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_transports/mock.py#L8-L43)
- SUPPORTED_DECODERS maps content-encoding names to ContentDecoder classes and drops unavailable optional codecs; Response selects and combines those decoders. default_encoding separately accepts a callable over buffered bytes for text detection. — [httpx/_decoders.py#L36-L41](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_decoders.py#L36-L41) [httpx/_decoders.py#L381-L393](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_decoders.py#L381-L393) [httpx/_models.py#L653-L672](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_models.py#L653-L672) [httpx/_models.py#L699-L722](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_models.py#L699-L722)
- CLI options are defined by Click decorators around main(), while package-level symbols are curated in __all__; test_all_imports_are_exported checks that public imports match the sorted export list. — [httpx/_main.py#L313-L363](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_main.py#L313-L363) [httpx/_main.py#L431-L452](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/_main.py#L431-L452) [httpx/__init__.py#L29-L100](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/httpx/__init__.py#L29-L100) [tests/test_exported_members.py#L4-L13](https://github.com/encode/httpx/blob/b5addb64f0161ff6bfe94c124ef76f6a1fba5254/tests/test_exported_members.py#L4-L13)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
