Repository navigation
Conversation
2 tasks done
jharibo
added a commit
to jharibo/pookx
that referenced
this pull request
Oct 21, 2026
parse_qs drops empty values by default, so param("x", "") never matched
?x=, and a mock for ?x= matched any query. Patch suggested in
h2non#181; docs and tests taken from h2non#188.
Co-authored-by: Priit Laes <91895+plaes@users.noreply.github.com>
Co-authored-by: Huanyi Xie <74809554+xiehuanyi@users.noreply.github.com>
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
QueryMatcherdrops empty query values during parsing. A dictionary expectation such as{"cursor": ""}rejects?cursor=, while the equivalent string expectation becomes an empty dictionary and can incorrectly match requests with a different cursor or no cursor.Keep blank values when parsing both expectations and request queries. Document that an expected empty value requires the parameter to be present. The regression tests cover dictionary and string expectations, missing and different parameters, and real mocked HTTP requests.
Fixes #181. This applies the
keep_blank_valuesapproach suggested by plaes.Validation: seven new cases fail on unmodified
master; the full suite passes 247 tests with three existing expected failures on Python 3.14.6 / pytest 8.4.2. Complete Ruff lint/format checks and the configured interceptor Mypy check pass. aiohttp 3.13.3 and urllib3 2.5.0 were used, within the declared ranges. Since port 8080 is occupied locally, an external test plugin binds the existing responder fixture to an ephemeral port and adjusts its fixture URL, including child pytest processes; no upstream assertions or fixture source were changed for this adjustment. Other interpreter/dependency versions were not run locally.Developed, reviewed, and tested with AI assistance.
PR Checklist