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:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user