Lowercase query parameter keys when parsing

This commit is contained in:
asonix 2024-03-03 14:35:01 -06:00 committed by Alex Auvolat
parent e285994977
commit 6ab80cd36a
No known key found for this signature in database
GPG key ID: 0E496D15096376BE

View file

@ -196,7 +196,7 @@ pub fn parse_query_map(uri: &http::uri::Uri) -> Result<QueryMap, Error> {
if let Some(query_str) = uri.query() { if let Some(query_str) = uri.query() {
let query_pairs = url::form_urlencoded::parse(query_str.as_bytes()); let query_pairs = url::form_urlencoded::parse(query_str.as_bytes());
for (key, val) in query_pairs { for (key, val) in query_pairs {
if query.insert(key.to_string(), val.into_owned()).is_some() { if query.insert(key.to_lowercase().to_string(), val.into_owned()).is_some() {
return Err(Error::bad_request(format!( return Err(Error::bad_request(format!(
"duplicate query parameter: `{}`", "duplicate query parameter: `{}`",
key key