Skip to content

Fix params replacing query set in URL#966

Open
KeeganOP wants to merge 2 commits into
pydantic:mainfrom
KeeganOP:params-replacing
Open

Fix params replacing query set in URL#966
KeeganOP wants to merge 2 commits into
pydantic:mainfrom
KeeganOP:params-replacing

Conversation

@KeeganOP
Copy link
Copy Markdown

Summary

Fixes #905 and resolves comments raised on PR: #961 by pulling over https://codeberg.org/httpxyz/httpxyz/commit/417d6c6fa193c5f29cdacefef6a4f7c9e5d30313 from @mbeijen

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 18, 2026

Merging this PR will not alter performance

✅ 7 untouched benchmarks


Comparing KeeganOP:params-replacing (3f77839) with main (c1d3d95)

Open in CodSpeed

@KeeganOP
Copy link
Copy Markdown
Author

KeeganOP commented May 18, 2026

I spotted this while testing as well:

client = httpx2.Client(base_url="https://api.example.com/v1?base_url=true", params={"api_key": "abc"})
request = client.build_request("GET", "users?active=true", params={"page": "2"})

assert str(request.url) == "https://api.example.com/v1/users?base_url=true&active=true&api_key=abc&page=2"

fails since the request.url comes out as:

https://api.example.com/v1?base_url=true/users?active=true&api_key=abc&page=2

Expected behavior? If not I'll update this PR to handle the above

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.

When the URL contains request parameters and the params parameter is set, the request parameters in the URL will disappear unexpectedly.

1 participant