Skip to content

Preserve existing URL query parameters when params are provided - #1174

Draft
ferstar wants to merge 1 commit into
pydantic:mainfrom
ferstar:codex/fix-preserve-url-query-params
Draft

Preserve existing URL query parameters when params are provided#1174
ferstar wants to merge 1 commit into
pydantic:mainfrom
ferstar:codex/fix-preserve-url-query-params

Conversation

@ferstar

@ferstar ferstar commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • preserve query parameters already present in a URL when additional params are provided
  • append same-name parameters instead of applying dictionary-style replacement
  • keep copy_with(params=...) and the query manipulation helpers replacement semantics unchanged
  • cover URL, Request, empty parameter inputs, same-name values, explicit queries, and invalid URL types

Closes #1173

Testing

  • uv run --frozen coverage run -m pytest -q — 1998 passed, 1 skipped
  • uv run --frozen coverage report --fail-under=100 — 100%
  • uv run --frozen ruff format --check --diff src/httpx2 tests/httpx2 src/httpcore2 tests/httpcore2 benchmark
  • uv run --frozen ruff check
  • uv run --frozen mypy src/httpx2 tests/httpx2 src/httpcore2 tests/httpcore2 benchmark
  • uv run --frozen python scripts/unasync.py --check

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This does not apply to typos.)
  • I have added a test for each introduced behavior and kept the change atomic.
  • Documentation changes are not required for this bug fix.

Review in cubic

@codspeed-hq

codspeed-hq Bot commented Aug 29, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 17 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing ferstar:codex/fix-preserve-url-query-params (063c764) with main (9fdafff)

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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.

Preserve existing URL query parameters when params are provided

1 participant