Fork me on GitHub

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 ?


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.


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.


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


Following up on what @ 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.


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.