Skip to content

Commit 17b1c5e

Browse files
authored
Merge pull request #555 from plippe/use-query-from-http-types
Use query from http types
2 parents d7baf70 + ef42cc1 commit 17b1c5e

File tree

2 files changed

+1
-109
lines changed

2 files changed

+1
-109
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`.

tests/querystring.rs

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)