diff --git a/CHANGELOG.md b/CHANGELOG.md index ade148fc..dd955803 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Re-export `http` crate and `hyper::Server`. ([#110](https://github.com/tokio-rs/axum/pull/110)) - Fix `Query` and `Form` extractors giving bad request error when query string is empty. ([#117](https://github.com/tokio-rs/axum/pull/117)) - Add `Path` extractor. ([#124](https://github.com/tokio-rs/axum/pull/124)) +- Fixed the implementation of `IntoResponse` of `(HeaderMap, T)` and `(StatusCode, HeaderMap, T)` would ignore headers from `T` ([#137](https://github.com/tokio-rs/axum/pull/137)) ## Breaking changes diff --git a/src/response.rs b/src/response.rs index 80d2d7a2..0ed511e4 100644 --- a/src/response.rs +++ b/src/response.rs @@ -158,7 +158,7 @@ where { fn into_response(self) -> Response
{ let mut res = self.1.into_response(); - *res.headers_mut() = self.0; + res.headers_mut().extend(self.0); res } } @@ -170,7 +170,7 @@ where fn into_response(self) -> Response { let mut res = self.2.into_response(); *res.status_mut() = self.0; - *res.headers_mut() = self.1; + res.headers_mut().extend(self.1); res } } @@ -264,3 +264,42 @@ impl