Preserve existing URL query parameters when params are provided
Draft
FE
3mo ago+46+46+01234567890123456789-10-10-01234567890123456789
Summary
- preserve query parameters already present in a URL when additional
paramsare 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 skippeduv run --frozen coverage report --fail-under=100— 100%uv run --frozen ruff format --check --diff src/httpx2 tests/httpx2 src/httpcore2 tests/httpcore2 benchmarkuv run --frozen ruff checkuv run --frozen mypy src/httpx2 tests/httpx2 src/httpcore2 tests/httpcore2 benchmarkuv 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.