mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 15:07:42 +02:00
body ergonomics v3 (#2468)
This commit is contained in:
@ -6,7 +6,7 @@ use std::{
|
||||
|
||||
use actix_codec::{AsyncRead, AsyncWrite, Framed};
|
||||
use actix_http::{
|
||||
body::{AnyBody, BodySize},
|
||||
body::{BodySize, BoxBody},
|
||||
h1,
|
||||
ws::{self, CloseCode, Frame, Item, Message},
|
||||
Error, HttpService, Request, Response,
|
||||
@ -50,14 +50,14 @@ enum WsServiceError {
|
||||
Dispatcher,
|
||||
}
|
||||
|
||||
impl From<WsServiceError> for Response<AnyBody> {
|
||||
impl From<WsServiceError> for Response<BoxBody> {
|
||||
fn from(err: WsServiceError) -> Self {
|
||||
match err {
|
||||
WsServiceError::Http(err) => err.into(),
|
||||
WsServiceError::Ws(err) => err.into(),
|
||||
WsServiceError::Io(_err) => unreachable!(),
|
||||
WsServiceError::Dispatcher => Response::internal_server_error()
|
||||
.set_body(AnyBody::from(format!("{}", err))),
|
||||
.set_body(BoxBody::new(format!("{}", err))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user