Trait ferrum::middleware::AfterMiddleware [] [src]

pub trait AfterMiddleware: Send + Sync + 'static {
    fn after(
        &self,
        _request: &mut Request,
        response: Response
    ) -> FerrumResult<Response> { ... }
fn catch(
        &self,
        _request: &mut Request,
        error: FerrumError
    ) -> FerrumResult<Response> { ... } }

AfterMiddleware are fired after a Handler is called inside of a Chain.

AfterMiddleware receive both a Request and a Response and are responsible for doing any response post-processing.

AfterMiddleware should not overwrite the contents of a Response. In the common case, a complete response is generated by the Chain's Handler and AfterMiddleware simply do post-processing of that Response, such as adding headers or logging.

Provided Methods

Do whatever post-processing this middleware should do.

Respond to an error thrown by previous AfterMiddleware, the Handler, or a BeforeMiddleware.

Returning Ok will cause the request to resume the normal flow at the next AfterMiddleware.

Implementations on Foreign Types

impl AfterMiddleware for Box<AfterMiddleware>
[src]

[src]

[src]

impl<T> AfterMiddleware for Arc<T> where
    T: AfterMiddleware
[src]

[src]

[src]

Implementors