EndpointHandler

trait EndpointHandler[F[_], B]

Handles the result of decoding a request using an endpoint's inputs.

class Object
trait Matchable
class Any

Value members

Abstract methods

def onDecodeFailure(ctx: DecodeFailureContext)(implicit monad: MonadError[F], bodyListener: BodyListener[F, B]): F[Option[ServerResponse[B]]]

Called when the given request hasn't been successfully decoded, because of the given failure on the given input. This is captured by the ctx parameter.

Called when the given request hasn't been successfully decoded, because of the given failure on the given input. This is captured by the ctx parameter.

Returns

An effect, describing the optional server response. If None, the next endpoint will be tried (if any).

def onDecodeSuccess[I](ctx: DecodeSuccessContext[F, I])(implicit monad: MonadError[F], bodyListener: BodyListener[F, B]): F[ServerResponse[B]]

Called when the request has been successfully decoded into data. This is captured by the ctx parameter.

Called when the request has been successfully decoded into data. This is captured by the ctx parameter.

Type Params
I

The type of the endpoint's inputs.

Returns

An effect, describing the server's response.