This commit is contained in:
Rob Ede 2025-08-29 03:36:26 +01:00
parent 471f1b3bb6
commit 588d7565aa
No known key found for this signature in database
GPG Key ID: F5E3FCAA33CBF062
2 changed files with 9 additions and 9 deletions

View File

@ -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 }

View File

@ -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<BoxBody> {
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::*;