Phase 2: HTTPXWrapper initial implementation#22704
Phase 2: HTTPXWrapper initial implementation#22704mwdd146980 wants to merge 1 commit intomwdd146980/httpx-migration-basefrom
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov Report❌ Patch coverage is Additional details and impacted files🚀 New features to boost your workflow:
|
Code reviewFound 2 issues:
🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
d4075a6 to
df634c5
Compare
97854d1 to
8fc9e4f
Compare
df634c5 to
c95925b
Compare
c95925b to
cdd0d69
Compare
05fc099 to
54aa5eb
Compare
cdd0d69 to
654cd59
Compare
|
✨ Fix all issues with BitsAI or with Cursor
|
6cc127d to
3cf3aa0
Compare
httpx was already present transitively via httpx-gssapi/ntlm/kerberos. Declaring it explicitly pins the version and signals intent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
88dfb33 to
bd007a7
Compare
3cf3aa0 to
033d0b2
Compare
Validation ReportAll 20 validations passed. Show details
|
|
Closing as stale — will reintroduce when httpx migration base lands. |

What does this PR do?
Implements Phase 2 of the requests → httpx migration (Phase 1: PR #22676).
New:
http_httpx.pyHTTPXWrapper— wrapshttpx.Client, satisfiesHTTPClientProtocol, translates httpx exceptions to theHTTPErrorhierarchyHTTPXResponseAdapter— bridgeshttpx.ResponsetoHTTPResponseProtocol: addsiter_content(httpx usesiter_bytes/iter_text), adaptsiter_linessignature, and adds__enter__/__exit__(httpx responses aren't context managers)httpx.TimeoutException→HTTPTimeoutError,httpx.ConnectError→HTTPConnectionError, etc.New:
use_httpxfeature flag inAgentCheck.httpuse_httpx: truein instance config to opt a check into the httpx backendself.httpget the flag for free; no call-site changes requiredRequestsWrapperProof of concept: nginx
test_get_enabled_endpointsandtest_only_query_enabled_endpointsnow run with both[requests]and[httpx]backends — all passrequests.Sessiondirectly (test_config,test_no_version) are left on the requests backend; they document the config parity gap (auth/SSL forwarding tohttpx.Client) deferred to Phase 3Backend equivalence tests
test_http_backend_equivalence.py:RequestsWrapperandHTTPXWrapperproduce identical responses forstatus_code,content,iter_lines,iter_content, and context manager usageKnown limitations (Phase 3 work)
HTTPXWrappercurrently wraps a plainhttpx.Client(). Instance config options (auth, TLS, proxy, timeouts) are not yet forwarded to the httpx client. Integrations that rely ontest_config-style assertions againstrequests.Sessionkwargs will need per-integration follow-up once config parity is implemented.Motivation
RFC: Migrate the HTTP layer from requests to httpx
Phase 1 established the protocol boundary. Phase 2 provides the httpx implementation and the opt-in mechanism.
Review checklist (to be filled by reviewers)
qa/skip-qalabel if the PR doesn't need to be tested during QA.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged