Middleware

sealed trait Middleware[-R, I, O]

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

Companion:
object
class Object
trait Matchable
class Any
Middleware[R, I, O]

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 handlerr), 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 handlerr), together with a decision about whether to continue or abort the handling of the request.

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.

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](httpApp: 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.