1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 00:50:20 +02:00

port identity middleware

This commit is contained in:
Nikolay Kim
2019-03-09 20:40:09 -08:00
parent 134863d5c8
commit 12f0c78091
5 changed files with 211 additions and 275 deletions

View File

@@ -82,8 +82,9 @@ impl<P> ServiceRequest<P> {
/// Create service response for error
#[inline]
pub fn error_response<E: Into<Error>>(self, err: E) -> ServiceResponse {
ServiceResponse::new(self.req, err.into().into())
pub fn error_response<B, E: Into<Error>>(self, err: E) -> ServiceResponse<B> {
let res: Response = err.into().into();
ServiceResponse::new(self.req, res.into_body())
}
/// This method returns reference to the request head
@@ -335,6 +336,12 @@ impl<B> ServiceResponse<B> {
}
}
/// Create service response for error
#[inline]
pub fn error_response<E: Into<Error>>(self, err: E) -> Self {
Self::from_err(err, self.request)
}
/// Get reference to original request
#[inline]
pub fn request(&self) -> &HttpRequest {