Fork me on GitHub
#pedestal
<
2018-08-26
>
lxsameer18:08:31

hey folks, how can I provide a list of default interceptors for all the handlers which gets merge with what ever interceptors list that handler provides ?

hlship19:08:20

I'd say that kind of thing is out of Pedestal's set of responsibilities. This kind of thing is typically solved in code: write a function that returns the routes, pass the default interceptors into that function, build the routes w/ those interceptors and your handlers.

hlship19:08:35

Alternately, you could start with the routes and write code that walks the set and modifies the entries to add the interceptors but that will be much more clumsy than just building the data structure right the first time.

martinklepsch07:08:21

Might misunderstand but there is a default-interceptors option IIRC. Maybe that’s what you’re looking for?

ddeaguiar12:08:39

Following up on what @U050TNB9F said, while Pedestal does provide default interceptors, you can override those default interceptors by specifying your own ‘default’ interceptors by assoc’ing them to the service map via the io.pedestal.http/interceptors key.

hlship15:08:23

To hopefully clarify: the default interceptors carry request processing through some initial steps, and ends with the router; the router takes it from there to find a specific route, and each route can have its own customized interceptor stack, terminating with a handler.