diff --git a/actix-http/src/header/map.rs b/actix-http/src/header/map.rs index d8a63b573..8445159d3 100644 --- a/actix-http/src/header/map.rs +++ b/actix-http/src/header/map.rs @@ -643,6 +643,15 @@ impl From for HeaderMap { } } +impl From<&T> for HeaderMap +where + T: Into, +{ + fn from(map: &T) -> Self { + map.to_owned().into() + } +} + /// Convert our `HeaderMap` to a `http::HeaderMap`. impl From for http::HeaderMap { fn from(map: HeaderMap) -> Self { @@ -650,6 +659,13 @@ impl From 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`]