CustomiseInterceptors

case class CustomiseInterceptors[F[_], O](createOptions: CustomiseInterceptors[F, O] => O, prependedInterceptors: List[Interceptor[F]], metricsInterceptor: Option[MetricsRequestInterceptor[F]], corsInterceptor: Option[CORSInterceptor[F]], rejectHandler: Option[RejectHandler[F]], exceptionHandler: Option[ExceptionHandler[F]], serverLog: Option[ServerLog[F]], notAcceptableInterceptor: Option[NotAcceptableInterceptor[F]], additionalInterceptors: List[Interceptor[F]], decodeFailureHandler: DecodeFailureHandler, appendedInterceptors: List[Interceptor[F]])

Allows customising the interceptors used by the server interpreter. Custom interceptors can be added via addInterceptor, sitting between two configurable, default interceptor groups.

The order of the interceptors corresponds to the ordering of the parameters.

Moreover, built-in interceptors can be customised or disabled. Once done, use .options to obtain the server interpreter options to use.

Value parameters:
additionalInterceptors

Additional interceptors, which will be called before (on request) / after (on response) the decodeFailureHandler one, e.g. performing logging, metrics, or providing alternate responses.

appendedInterceptors

Additional interceptors, which will be called last on request / first on response, e.g. handling decode failures, or providing alternate responses.

decodeFailureHandler

The decode failure handler, from which an interceptor will be created. Determines whether to respond when an input fails to decode.

exceptionHandler

Whether to respond to exceptions in the server logic, or propagate them to the server.

metricsInterceptor

Whether to collect metrics.

notAcceptableInterceptor

Whether to return 406 (not acceptable) if there's no body in the endpoint's outputs, which can satisfy the constraints from the Accept header.

prependedInterceptors

Additional interceptors, which will be called first on request / last on response, e.g. performing logging, metrics, or providing alternate responses.

rejectHandler

How to respond when decoding fails for all interpreted endpoints.

serverLog

The server log using which an interceptor will be created, if any.

trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

def defaultHandlers(errorMessageOutput: String => ValuedEndpointOutput[_], notFoundWhenRejected: Boolean): CustomiseInterceptors[F, O]

Use the default exception, decode failure and reject handlers.

Use the default exception, decode failure and reject handlers.

Value parameters:
errorMessageOutput

customise the way error messages are shown in error responses

notFoundWhenRejected

return a 404 formatted using errorMessageOutput when the request was rejected by all endpoints, instead of propagating the rejection to the server library

Creates the default interceptor stack

Creates the default interceptor stack

def options: O
def serverLog(log: Option[ServerLog[F]]): CustomiseInterceptors[F, O]

Inherited methods

def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product