Browse Source

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

Michael Mroz 3 years ago
parent
commit
078287301d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      packages/router/src/hooks/use_route.rs

+ 1 - 1
packages/router/src/hooks/use_route.rs

@@ -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.