Skip to content

Commit ef42cc1

Browse files
committed
Forward to http::Request
1 parent c282e92 commit ef42cc1

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/request.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,7 @@ impl<State> Request<State> {
282282

283283
/// Get the URL querystring.
284284
pub fn query<T: serde::de::DeserializeOwned>(&self) -> crate::Result<T> {
285-
// Default to an empty query string if no query parameter has been specified.
286-
// This allows successful deserialisation of structs where all fields are optional
287-
// when none of those fields has actually been passed by the caller.
288-
let query = self.url().query().unwrap_or("");
289-
serde_qs::from_str(query).map_err(|e| {
290-
// Return the displayable version of the deserialisation error to the caller
291-
// for easier debugging.
292-
crate::Error::from_str(StatusCode::BadRequest, format!("{}", e))
293-
})
285+
self.req.query()
294286
}
295287

296288
/// Take the request body as a `Body`.

0 commit comments

Comments
 (0)