How to get all the headers in warp

How to get all the headers in warp?

Code to get Single Header

let index = warp::path::end()
        .and(warp::get())
        .and(warp::header::<String>("host"))
        .map(|h| {
            println!("{}", h);
            "hello"
        });

How can I get all the headers in warp?
Thank you

I think you can use headers_cloned.

1 Like

@RedDocMD Thank you so much

If anyone need in future here is the code

let index = warp::path::end()
        .and(warp::get())
        .and(warp::header::headers_cloned())
        .map(|h| {
            println!("{:?}", h);
            "hello"
        });

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.