pub fn normalize_query_parameters(
query_string: &str,
) -> Result<HashMap<String, Vec<String>>, SignatureError>
Expand description
Normalize the query parameters by normalizing the keys and values of each parameter and return a HashMap
mapping
each key to a vector of values (since it is valid for a query parameters to appear multiple times).
The order of the values matches the order that they appeared in the query string – this is important for SigV4 validation.
Keys and values are normalized according to the rules of normalize_uri_path_component
.
§Errors
If any key or value cannot be normalized as a URI path component, a SignatureError::InvalidURIPath
error is
returned.
§Example
let result = normalize_query_parameters("a=1&b=2&a=3&c=4").unwrap();
assert_eq!(result.get("a").unwrap(), &vec!["1", "3"]);
assert_eq!(result.get("b").unwrap(), &vec!["2"]);
assert_eq!(result.get("c").unwrap(), &vec!["4"]);