async fn main() {
// GET /hello/warp => 200 OK with body "Hello, warp!"
let hello = warp::path!("hello" / String)
- .map(|name| format!("Hello, {}!", name));
+ .and(warp::header::<String>("user-agent"))
+ .map(|name, agent| format!("Hello, {} from {}!", name, agent));
warp::serve(hello)
.run(([127, 0, 0, 1], 3030))