Iterating queryparams? #444
Answered
by
sunli829
jakob-lilliemarck
asked this question in
Q&A
-
Hey, I'm trying to write a poem-middleware that creates a |
Beta Was this translation helpful? Give feedback.
Answered by
sunli829
Dec 5, 2022
Replies: 1 comment 1 reply
-
so easy: 🙂 let app = Route::new()
.at("/hello/:name", get(hello))
.around(|ep, request| async move {
// parse the query params
let query_params = request.params::<Vec<(String, String)>>()?;
for (name, value) in query_params {
// do something...
println!("{}: {}", name, value);
}
ep.call(request).await // call the next handler
})
.with(Tracing); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jakob-lilliemarck
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
so easy: 🙂