diff --git a/Cargo.toml b/Cargo.toml
index 75b5e3a8e..5aa302333 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 31ad277de..893a15cda 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`. [#????]
* `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. [#????]
+* Conversion (`impl Into`) of `Response
` and `ResponseBuilder` to `Error`. [#????]
[#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
+[#????]: https://github.com/actix/actix-web/pull/????
## 3.0.0-beta.6 - 2021-04-17
diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml
index 638557807..1f7df39a6 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/error.rs b/actix-http/src/error.rs
index 20b2a2d75..92efd572d 100644
--- a/actix-http/src/error.rs
+++ b/actix-http/src/error.rs
@@ -1,7 +1,6 @@
//! Error and Result module
use std::{
- cell::RefCell,
error::Error as StdError,
fmt,
io::{self, Write as _},
@@ -14,7 +13,7 @@ use derive_more::{Display, Error, From};
use http::{header, uri::InvalidUri, StatusCode};
use serde::de::value::Error as DeError;
-use crate::{body::Body, helpers::Writer, Response, ResponseBuilder};
+use crate::{body::Body, helpers::Writer, Response};
pub use http::Error as HttpError;
@@ -121,20 +120,6 @@ impl From for Error {
}
}
-/// Convert Response to a Error
-impl From> for Error {
- fn from(res: Response) -> Error {
- InternalError::from_response("", res).into()
- }
-}
-
-/// Convert ResponseBuilder to a Error
-impl From for Error {
- fn from(mut res: ResponseBuilder) -> Error {
- InternalError::from_response("", res.finish()).into()
- }
-}
-
#[derive(Debug, Display, Error)]
#[display(fmt = "Unknown Error")]
struct UnitError;
@@ -449,179 +434,12 @@ mod content_type_test_impls {
}
}
-/// Return `BadRequest` for `ContentTypeError`
impl ResponseError for ContentTypeError {
fn status_code(&self) -> StatusCode {
StatusCode::BAD_REQUEST
}
}
-/// Helper type that can wrap any error and generate custom response.
-///
-/// In following example any `io::Error` will be converted into "BAD REQUEST"
-/// response as opposite to *INTERNAL SERVER ERROR* which is defined by
-/// default.
-///
-/// ```
-/// # use std::io;
-/// # use actix_http::{error, Request};
-/// fn index(req: Request) -> Result<&'static str, actix_http::Error> {
-/// Err(error::ErrorBadRequest(io::Error::new(io::ErrorKind::Other, "error")))
-/// }
-/// ```
-pub struct InternalError {
- cause: T,
- status: InternalErrorType,
-}
-
-enum InternalErrorType {
- Status(StatusCode),
- Response(RefCell