Default Interceptors

Pedestal provides a "default set" of interceptors when using the with-default-interceptors function.

These are presented in the order that they appear in the interceptor vector. That means their :enter functions will be called in the order they appear in this document, and their :leave functions are called in reverse order.

The following identifies the interceptor by their var or function, in the order they may be added by with-default-interceptors.

log-request

Logs each request at info level. See Logging to configure loggers and logging levels.

allow-origin

Added only when the options include :allowed-origins.

not-found

Provides a 404 Not Found response when not :response is yet added to the context map; typically because the incoming request could not be matched to a route.

session

Adds support for per-client session tracking; added to the connector map when :session-options are provided.

content-type

Applies a Content-Type header to a response if missing by mapping the file name extension in the request’s URI.

query-params

Parses the :query-string into the :query-params map added to the request.

body-params

Uses the request’s Content-Type header to determine how to parse the request :body into data.

secure-headers

Adds security-related headers to the outgoing response.

with-default-interceptors is intended as scaffolding; a Pedestal application should replace the call to with-default-interceptors with the exact interceptors it requires, configured according the application’s needs.