diff --git a/actix-web/Cargo.toml b/actix-web/Cargo.toml index f0fcf6827..765c9a1cd 100644 --- a/actix-web/Cargo.toml +++ b/actix-web/Cargo.toml @@ -86,10 +86,10 @@ cookies = ["dep:cookie"] # Secure & signed cookies secure-cookies = ["cookies", "cookie/secure"] -# HTTP/2 support (including h2c). +# HTTP/2 support (including h2c) http2 = ["actix-http/http2"] -# Websockets support +# WebSocket support ws = ["actix-http/ws"] # TLS via OpenSSL @@ -135,7 +135,7 @@ actix-service = "2" actix-tls = { version = "3.4", default-features = false, optional = true } actix-utils = "3" -actix-http = { version = "3.11" } +actix-http = { version = "3.11" } actix-router = { version = "0.5.3", default-features = false, features = ["http"] } actix-web-codegen = { version = "4.3", optional = true, default-features = false } diff --git a/actix-web/src/error/response_error.rs b/actix-web/src/error/response_error.rs index 0b7d67153..ab3ec59b4 100644 --- a/actix-web/src/error/response_error.rs +++ b/actix-web/src/error/response_error.rs @@ -7,8 +7,6 @@ use std::{ io::{self, Write as _}, }; -#[cfg(feature = "ws")] -use actix_http::Response; use bytes::BytesMut; use crate::{ @@ -127,9 +125,6 @@ impl ResponseError for actix_http::error::PayloadError { } } -#[cfg(feature = "ws")] -impl ResponseError for actix_http::ws::ProtocolError {} - impl ResponseError for actix_http::error::ContentTypeError { fn status_code(&self) -> StatusCode { StatusCode::BAD_REQUEST @@ -139,10 +134,15 @@ impl ResponseError for actix_http::error::ContentTypeError { #[cfg(feature = "ws")] impl ResponseError for actix_http::ws::HandshakeError { fn error_response(&self) -> HttpResponse { - Response::from(self).map_into_boxed_body().into() + actix_http::Response::from(self) + .map_into_boxed_body() + .into() } } +#[cfg(feature = "ws")] +impl ResponseError for actix_http::ws::ProtocolError {} + #[cfg(test)] mod tests { use super::*;