http-rs / surf

Fast and friendly HTTP client framework for async Rust
https://docs.rs/surf
Apache License 2.0
1.45k stars 119 forks source link

no way to get all response headers in surf 2.0.0 #212

Closed yshui closed 4 years ago

yshui commented 4 years ago

I can only get header values by name, using .header().

surf 1.0 had .headers()

yshui commented 4 years ago

Suggestion:

Add this to impl Response

    pub fn headers(&self) -> impl Iterator<Item = (&HeaderName, &HeaderValues)> {
        (&self.response).into_iter()
    }
Fishrock123 commented 4 years ago

@yshui Try using the main branch here: Note: that stuff may change at any time! best to pin to a commit then.

surf = { git = "https://github.com/http-rs/surf.git", branch = "main" }

There should be a new alpha with all the new stuff soonish.

yshui commented 4 years ago

Ah, sorry, I didn't check the git version :sweat_smile: