feat(core): recover repeated @httpQuery params via query_param_all (bug-hunt 1.45)#2293
Merged
Conversation
…param_all (bug-hunt 1.45) The axum `Query<HashMap<String,String>>` extraction — and the `query_params` map on `AwsRequest` derived from it — collapses repeated query keys, keeping only the last value of `?Id=a&Id=b&Id=c`. That silently drops multi-value `@httpQuery` parameters (list-style filters / ids). `raw_query` already preserves the full query string, so this adds a first-class accessor `AwsRequest::query_param_all(key) -> Vec<String>` that re-parses it and returns every occurrence in wire order, plus a `pub(crate)` `protocol::form_urlencoded_pairs` that decodes into ordered (key, value) pairs (reusing the existing UTF-8-correct `url_decode`). Handlers that need repeated keys can now recover them without a repo-wide change to the core representation. Tests: repeated keys preserved (vs the HashMap collapsing to the last value); percent/plus decoding.
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.
Summary
The axum
Query<HashMap<String,String>>extraction — and thequery_paramsmap onAwsRequestderived from it — collapses repeated query keys, keeping only the last value of?Id=a&Id=b&Id=c. That silently drops multi-value@httpQueryparameters (list-style filters / ids). This is the known-systemic finding 1.45 (LOW).raw_queryalready preserves the full query string, so rather than a repo-wide change to the core representation, this adds first-class recovery:AwsRequest::query_param_all(key) -> Vec<String>— re-parsesraw_queryand returns every occurrence of a repeated key, in wire order (empty vec if absent).pub(crate) protocol::form_urlencoded_pairs(&str) -> Vec<(String, String)>— decodes into ordered pairs, reusing the existing UTF-8-correcturl_decode(theHashMapdecoder that collapses repeats is untouched).Handlers that legitimately accept repeated keys can now recover them without every caller re-implementing query parsing, and without disturbing the
query_paramsfast path every other handler relies on.Test plan
cargo test -p fakecloud-core --lib form_urlencoded_pairs— repeated keys preserved as[a, b, c](vs theHashMapform collapsing toc); percent/+decoding (caf%C3%A9+bar→café bar).cargo clippy -p fakecloud-core --tests -- -D warningsclean.Additive API only — no existing behavior changes, no SDK/docs surface.
Summary by cubic
Adds AwsRequest::query_param_all to return all values of repeated @httpquery params by re-parsing raw_query, fixing the drop of multi-value filters (bug-hunt 1.45). The existing HashMap-based query_params behavior stays unchanged.
Written for commit 66ad932. Summary will update on new commits.