mirror of
https://github.com/tokio-rs/axum.git
synced 2024-11-22 07:08:16 +01:00
Implement IntoResponse
for boxed slices (#2035)
This commit is contained in:
parent
466cfcddf7
commit
adb387a370
2 changed files with 13 additions and 0 deletions
|
@ -190,6 +190,12 @@ impl IntoResponse for String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl IntoResponse for Box<str> {
|
||||||
|
fn into_response(self) -> Response {
|
||||||
|
String::from(self).into_response()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl IntoResponse for Cow<'static, str> {
|
impl IntoResponse for Cow<'static, str> {
|
||||||
fn into_response(self) -> Response {
|
fn into_response(self) -> Response {
|
||||||
let mut res = Body::from(self).into_response();
|
let mut res = Body::from(self).into_response();
|
||||||
|
@ -315,6 +321,12 @@ impl IntoResponse for Vec<u8> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl IntoResponse for Box<[u8]> {
|
||||||
|
fn into_response(self) -> Response {
|
||||||
|
Vec::from(self).into_response()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl IntoResponse for Cow<'static, [u8]> {
|
impl IntoResponse for Cow<'static, [u8]> {
|
||||||
fn into_response(self) -> Response {
|
fn into_response(self) -> Response {
|
||||||
let mut res = Body::from(self).into_response();
|
let mut res = Body::from(self).into_response();
|
||||||
|
|
|
@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- **breaking:** Only inherit fallbacks for routers nested with `Router::nest`.
|
- **breaking:** Only inherit fallbacks for routers nested with `Router::nest`.
|
||||||
Routers nested with `Router::nest_service` will no longer inherit fallbacks ([#1956])
|
Routers nested with `Router::nest_service` will no longer inherit fallbacks ([#1956])
|
||||||
- **fixed:** Don't remove the `Sec-WebSocket-Key` header in `WebSocketUpgrade` ([#1972])
|
- **fixed:** Don't remove the `Sec-WebSocket-Key` header in `WebSocketUpgrade` ([#1972])
|
||||||
|
- **added:** Implement `IntoResponse` for `Box<str>` and `Box<[u8]>` ([#2035])
|
||||||
|
|
||||||
[#1664]: https://github.com/tokio-rs/axum/pull/1664
|
[#1664]: https://github.com/tokio-rs/axum/pull/1664
|
||||||
[#1751]: https://github.com/tokio-rs/axum/pull/1751
|
[#1751]: https://github.com/tokio-rs/axum/pull/1751
|
||||||
|
|
Loading…
Reference in a new issue