Module middleware

Source
Expand description

Middleware traits and implementations.

A middleware decorates an service and provides additional functionality. This additional functionality may include, but is not limited to:

  • Rejecting the request.
  • Taking an action based on the request.
  • Mutating the request before passing it along to the application.
  • Mutating the response returned by the application.

A middleware implements the Middleware trait.

Currently, the following middleware implementations are provided:

More will come.

Note: This module will eventually be extracted out of tower-web into tower and tower-http.

Modules§

cors
CORS middleware.
deflate
Middleware that deflates HTTP response bodies
log
Middleware that creates a log entry for each HTTP request.

Structs§

Chain
Two middlewares chained together.
Identity
A no-op middleware.

Traits§

Middleware
Decorates a Service, transforming either the request or the response.