Module middleware

Source
Expand description

Experimental middleware.

Analogous to the middleware module in Actix Web.

Structs§

CatchPanic
A middleware to catch panics in wrapped handlers and middleware, returning empty 500 responses.
ErrorHandlers
Middleware for registering custom status code based error handlers.
LoadShed
A middleware that sheds load when the inner service isn’t ready.
MapResBodyMiddleware
Middleware transform for map_response_body.
MapResMiddleware
Middleware transform for map_response.
MiddlewareFn
Middleware transform for from_fn.
Next
Wraps the “next” service in the middleware chain.
NormalizePath
Middleware for normalizing a request’s path so that routes can be matched more flexibly.
PanicReporter
A middleware that triggers a callback when the worker is panicking.
RedirectHttps
A middleware to redirect traffic to HTTPS if connection is insecure.

Functions§

from_fn
Wraps an async function to be used as a middleware.
map_response
Creates a middleware from an async function that is used as a mapping function for a ServiceResponse.
map_response_body
Creates a middleware from an async function that is used as a mapping function for an impl MessageBody.
redirect_to_www
A function middleware to redirect traffic to www. if not already there.