Implement IntoResponse for http::response::Parts (#490)

* Implement `IntoResponse` for `http::response::Parts`

Not sure there are many use cases for this but still thinks it makes to
provide since other crates can't.

* Use `Response::from_parts`
This commit is contained in:
David Pedersen 2021-11-09 20:50:29 +01:00 committed by GitHub
parent 2ee66e812f
commit 62be8aaa18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# Unreleased
- None
- Implement `IntoResponse` for `http::response::Parts` ([#490])
[#490]: https://github.com/tokio-rs/axum/pull/490
# 0.3.2 (08. November, 2021)

View file

@ -245,6 +245,15 @@ impl_into_response_for_body!(hyper::Body);
impl_into_response_for_body!(Full<Bytes>);
impl_into_response_for_body!(Empty<Bytes>);
impl IntoResponse for http::response::Parts {
type Body = Empty<Bytes>;
type BodyError = Infallible;
fn into_response(self) -> Response<Self::Body> {
Response::from_parts(self, Empty::new())
}
}
impl<E> IntoResponse for http_body::combinators::BoxBody<Bytes, E>
where
E: Into<BoxError> + 'static,