Middleware

zio.http.api.Middleware
See theMiddleware companion object
sealed trait Middleware[-R, I, O]

A Middleware represents the implementation of a MiddlewareSpec, intercepting parts of the request, and appending to the response.

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Middleware[R, I, O]

Members list

Concise view

Type members

Types

type State

Value members

Abstract methods

def incoming(in: I): ZIO[R, Nothing, Control[State]]

Processes an incoming request, whose relevant parts are encoded into I, the middleware input, and then returns an effect that will produce both middleware-specific state (which will be passed to the outgoing handler), together with a decision about whether to continue or abort the handling of the request.

Processes an incoming request, whose relevant parts are encoded into I, the middleware input, and then returns an effect that will produce both middleware-specific state (which will be passed to the outgoing handler), together with a decision about whether to continue or abort the handling of the request.

Attributes

def outgoing(state: State, response: Response): ZIO[R, Nothing, O]

Processes an outgoing response together with the middleware state (produced by the incoming handler), returning an effect that will produce O, which will in turn be used to patch the response.

Processes an outgoing response together with the middleware state (produced by the incoming handler), returning an effect that will produce O, which will in turn be used to patch the response.

Attributes

def spec: MiddlewareSpec[I, O]

Concrete methods

def ++[R1 <: R, I2, O2](that: Middleware[R1, I2, O2])(implicit inCombiner: Combiner[I, I2], outCombiner: Combiner[O, O2]): Middleware[R1, Out, Out]
def apply[R1 <: R, E](httpRoute: HttpApp[R1, E]): HttpApp[R1, E]

Applies the middleware to an HttpApp, returning a new HttpApp with the middleware fully installed.

Applies the middleware to an HttpApp, returning a new HttpApp with the middleware fully installed.

Attributes