diff --git a/Cargo.toml b/Cargo.toml
index 75b5e3a8..5aa30233 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -82,6 +82,7 @@ language-tags = "0.3"
once_cell = "1.5"
log = "0.4"
mime = "0.3"
+paste = "1"
pin-project = "1.0.0"
regex = "1.4"
serde = { version = "1.0", features = ["derive"] }
diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md
index 31ad277d..ec7d8ee3 100644
--- a/actix-http/CHANGES.md
+++ b/actix-http/CHANGES.md
@@ -2,6 +2,7 @@
## Unreleased - 2021-xx-xx
### Added
+* Alias `body::Body` as `body::AnyBody`. [#2215]
* `BoxAnyBody`: a boxed message body with boxed errors. [#2183]
* Re-export `http` crate's `Error` type as `error::HttpError`. [#2171]
* Re-export `StatusCode`, `Method`, `Version` and `Uri` at the crate root. [#2171]
@@ -25,12 +26,15 @@
* Error field from `Response` and `Response::error`. [#2205]
* `impl Future` for `Response`. [#2201]
* `Response::take_body` and old `Response::into_body` method that casted body type. [#2201]
+* `InternalError` and all the error types it constructed. [#2215]
+* Conversion (`impl Into`) of `Response
` and `ResponseBuilder` to `Error`. [#2215]
[#2171]: https://github.com/actix/actix-web/pull/2171
[#2183]: https://github.com/actix/actix-web/pull/2183
[#2196]: https://github.com/actix/actix-web/pull/2196
[#2201]: https://github.com/actix/actix-web/pull/2201
[#2205]: https://github.com/actix/actix-web/pull/2205
+[#2215]: https://github.com/actix/actix-web/pull/2215
## 3.0.0-beta.6 - 2021-04-17
diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml
index 63855780..1f7df39a 100644
--- a/actix-http/Cargo.toml
+++ b/actix-http/Cargo.toml
@@ -62,7 +62,6 @@ local-channel = "0.1"
once_cell = "1.5"
log = "0.4"
mime = "0.3"
-paste = "1"
percent-encoding = "2.1"
pin-project = "1.0.0"
pin-project-lite = "0.2"
diff --git a/actix-http/src/body/body.rs b/actix-http/src/body/body.rs
index 4c95bd31..3fda8ae1 100644
--- a/actix-http/src/body/body.rs
+++ b/actix-http/src/body/body.rs
@@ -13,9 +13,10 @@ use crate::error::Error;
use super::{BodySize, BodyStream, MessageBody, MessageBodyMapErr, SizedStream};
+pub type Body = AnyBody;
+
/// Represents various types of HTTP message body.
-// #[deprecated(since = "4.0.0", note = "Use body types directly.")]
-pub enum Body {
+pub enum AnyBody {
/// Empty response. `Content-Length` header is not set.
None,
@@ -29,14 +30,14 @@ pub enum Body {
Message(BoxAnyBody),
}
-impl Body {
+impl AnyBody {
/// Create body from slice (copy)
- pub fn from_slice(s: &[u8]) -> Body {
- Body::Bytes(Bytes::copy_from_slice(s))
+ pub fn from_slice(s: &[u8]) -> Self {
+ Self::Bytes(Bytes::copy_from_slice(s))
}
/// Create body from generic message body.
- pub fn from_message(body: B) -> Body
+ pub fn from_message(body: B) -> Self
where
B: MessageBody + 'static,
B::Error: Into>,
@@ -45,15 +46,15 @@ impl Body {
}
}
-impl MessageBody for Body {
+impl MessageBody for AnyBody {
type Error = Error;
fn size(&self) -> BodySize {
match self {
- Body::None => BodySize::None,
- Body::Empty => BodySize::Empty,
- Body::Bytes(ref bin) => BodySize::Sized(bin.len() as u64),
- Body::Message(ref body) => body.size(),
+ AnyBody::None => BodySize::None,
+ AnyBody::Empty => BodySize::Empty,
+ AnyBody::Bytes(ref bin) => BodySize::Sized(bin.len() as u64),
+ AnyBody::Message(ref body) => body.size(),
}
}
@@ -62,9 +63,9 @@ impl MessageBody for Body {
cx: &mut Context<'_>,
) -> Poll