Skip to content

fix: correct dispatch criteria mismatch for QUERY_HEADER multi-header rules - #2388

Merged
lbroudoux merged 1 commit into
microcks:masterfrom
prasu-baran:fix/2386-query-header-dispatch
Oct 22, 2026
Merged

lbroudoux merged 1 commit into
microcks:masterfrom
prasu-baran:fix/2386-query-header-dispatch

Conversation

@prasu-baran

Copy link
Copy Markdown
Contributor

Description

  • **extractFromParamMap()** (used at request time) and **buildFromParamsMap()** (used at import time) are meant to build the exact same dispatch-criteria string from the same headers, but didn't.
    extractFromParamMap() sorted the keys and then lost that order by putting them in a HashSet and matched header names with a plain contains() instead of a whole-word check. So any QUERY_HEADER rule with 2+ headers could never match at runtime and a rule like accept-language could wrongly pick up the unrelated accept header every client sends.
  • Fix: use a TreeSet to keep the keys sorted (matching the import side) and reuse the same word-boundary check buildFromParamsMap() already has, instead of contains().
  • Added two tests that call both methods with the same data and check the output matches : one for multi-header ordering and the one for the substring collision. Both fail on the old code but now passes with the fix. Also ran every existing test that touches this method (REST, Postman, HAR, Examples, AI Copilot) - all pass. spotless:check is clean.

Related issue(s)

Fixes #2386

…R multi-header rules

Signed-off-by: Prasun Baranwal <[email protected]>

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks nice. Thank you!

@lbroudoux lbroudoux added this to the 1.16.0 milestone Oct 22, 2026
@lbroudoux
lbroudoux merged commit 9b84ef2 into microcks:master Oct 22, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QUERY_HEADER dispatcher fails to match multi-header rules

2 participants