Skip to content

Append new query parameters after existing parameters - #197

Open
oyeong011 wants to merge 1 commit into
python-hyper:masterfrom
oyeong011:fix/append-new-query-parameters
Open

Append new query parameters after existing parameters#197
oyeong011 wants to merge 1 commit into
python-hyper:masterfrom
oyeong011:fix/append-new-query-parameters

Conversation

@oyeong011

Copy link
Copy Markdown

URL.set() and DecodedURL.set() insert a previously absent query parameter before the final existing parameter because the fallback insertion index is -1. Use the end of the filtered query instead, while preserving the first position when replacing existing occurrences.

The existing test_set_ordering already documented the expected append behavior in a TODO. The regression now checks it, plus both URL types, empty/single/multiple queries, duplicate replacement, and input immutability.

Validation: 137 tests/doctests passed on Python 3.11; public API checks also passed with 10,000 query entries. Historical Python versions were not available.

AI disclosure: this patch and its tests were prepared with OpenAI Codex and verified by executing the tests and public APIs.

Existing parameter replacements retain their first position; new names no longer use a negative insertion index.

Constraint: Preserve Python 2-compatible source style and both URL types
Confidence: high
Scope-risk: narrow
Tested: 137 tests and doctests; actual URL and DecodedURL calls including 10000 query entries
Not-tested: Historical Python interpreters
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.

1 participant