mirror of
https://github.com/actix/actix-web.git
synced 2024-12-30 12:00:38 +00:00
add Responder impl for InternalError
This commit is contained in:
parent
0de47211b2
commit
1a80b70868
1 changed files with 13 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
use actix_http::error::InternalError;
|
||||
use actix_http::{dev::ResponseBuilder, http::StatusCode, Error, Response};
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use futures::future::{err, ok, Either as EitherFuture, FutureResult};
|
||||
|
@ -252,6 +253,18 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Responder for InternalError<T>
|
||||
where
|
||||
T: std::fmt::Debug + std::fmt::Display + 'static,
|
||||
{
|
||||
type Error = Error;
|
||||
type Future = Result<Response, Error>;
|
||||
|
||||
fn respond_to(self, _: &HttpRequest) -> Self::Future {
|
||||
Err(self.into())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ResponseFuture<T>(T);
|
||||
|
||||
impl<T> ResponseFuture<T> {
|
||||
|
|
Loading…
Reference in a new issue