From 1fb80a1129b73f1cc86e060a5389d117ebdf523e Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Thu, 22 Jul 2021 21:21:53 +0200 Subject: [PATCH] Implement `IntoResponse` for `HeaderMap` --- src/response.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/response.rs b/src/response.rs index cc4850a3..de2f5d79 100644 --- a/src/response.rs +++ b/src/response.rs @@ -169,6 +169,14 @@ where } } +impl IntoResponse for HeaderMap { + fn into_response(self) -> Response { + let mut res = Response::new(Body::empty()); + *res.headers_mut() = self; + res + } +} + /// An HTML response. /// /// Will automatically get `Content-Type: text/html`.