Skip to content

Remove _merge_url_query once httpx2 merges params into the URL query #146

Description

@lesnik512

Context

httpx2 replaces a URL's query string whenever params are sent, including client-level params (pydantic/httpx2#905). httpware works around this in src/httpware/client.py: #145 (0.17.1) added the workaround, and #156 replaced it with _build_request, which strips the URL's query, lets httpx2 build the request, then puts the original query bytes back in front of the params. stream() goes through _stream / _stream_async for the same reason. Semantics match requests and pydantic/httpx2#966: params are appended after the URL's query, duplicate keys are kept, and the URL's query bytes are not re-encoded.

Blocked on

An httpx2 release that merges params into the existing URL query. Candidate fix: pydantic/httpx2#966 (open, unreviewed as of 2026-10-03). An earlier attempt, pydantic/httpx2#1026, was closed unmerged.

When unblocked

  1. Check upstream semantics still match ours: params appended after the URL query, duplicate keys kept, client params before per-request params, params={} keeps the URL query, URL query bytes unchanged.
  2. Raise the httpx2 floor in pyproject.toml to the release containing the fix.
  3. Replace every _build_request(client, method, url, kwargs) call (build_request, _prepare_request and the capped stream helpers, in both worlds) with client.build_request(method, url, **kwargs), and delete _build_request. The uncapped stream() path can go back to self._httpx2_client.stream, dropping _stream / _stream_async.
  4. Keep tests/test_url_query_merge.py: it passes 50/50 against #966 (2631c38) with the workaround stubbed out, so it should pass unchanged. If a case fails, upstream semantics differ from #966 and that is a behaviour change to call out in the release.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedWaiting on an external dependency or upstream change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions