Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement From<&HeaderMap> for http::HeaderMap #3230

Merged
merged 12 commits into from
Feb 1, 2024
4 changes: 4 additions & 0 deletions actix-http/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Added

- Implement `From<&HeaderMap>` for `http::HeaderMap`.

## 3.5.1

### Fixed
Expand Down
7 changes: 7 additions & 0 deletions actix-http/src/header/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,13 @@ impl From<HeaderMap> for http::HeaderMap {
}
}

/// Convert our `&HeaderMap` to a `http::HeaderMap`.
impl From<&HeaderMap> for http::HeaderMap {
fn from(map: &HeaderMap) -> Self {
map.to_owned().into()
}
}

/// Iterator over removed, owned values with the same associated name.
///
/// Returned from methods that remove or replace items. See [`HeaderMap::insert`]
Expand Down
Loading