Fix query parsing: the router was silently throwing away queries not prefixed with an extra '?'

This commit is contained in:
Michael Mroz committed 2022-04-17 01:51:02 -07:00
1 parent 510f07bcec
commit 078287301d
1 file changed
+1 -1
+1 -1
View File
@@ -51,7 +51,7 @@ impl UseRoute {
#[cfg(feature = "query")]
pub fn query<T: serde::de::DeserializeOwned>(&self) -> Option<T> {
let query = self.url().query()?;
serde_urlencoded::from_str(query.strip_prefix('?').unwrap_or("")).ok()
serde_urlencoded::from_str(query).ok()
}
/// Get the first query parameter given the parameter name.