Skip to content

matchers/query: match repeated query parameter values in order - #4

Merged
jharibo merged 1 commit into
masterfrom
fix-query-repeated-values
Oct 21, 2026
Merged

jharibo merged 1 commit into
masterfrom
fix-query-repeated-values

Conversation

@jharibo

@jharibo jharibo commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Description

A query parameter sent more than once could never match a mock. Both .params({"x": ["a", "b"]}) and a mock URL ending in ?x=a&x=b failed against a request for ?x=a&x=b, because each expected value was compared against every received value, so a vs b always failed.

List values are now compared position by position, and the number of values must match. A single value behaves as before: it must equal every value received for that key. Taken from h2non#187.

Worth a look: one case gets stricter. ["a", "a"] used to match any number of as and now needs exactly two.

Full suite passes (299 passed, 3 xfailed).

PR Checklist

  • I've added tests for any code changes
  • I've documented any new features (the params() docstring now explains lists vs single values)

Every expected value was compared against every received value, so
?x=a&x=b never matched. List values now match pairwise and by count.
Taken from h2non#187.

Co-authored-by: bensynapse <118375461+bensynapse@users.noreply.github.com>
@jharibo
jharibo merged commit 3cd87a1 into master Oct 21, 2026
9 checks passed
@jharibo
jharibo deleted the fix-query-repeated-values branch October 21, 2026 18:28
@jharibo jharibo mentioned this pull request Oct 21, 2026
2 tasks
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