Fork me on GitHub
#pedestal
<
2018-08-30
>
ddeaguiar13:08:14

The default not-found interceptor will return a 404 response if a valid response is not found on the context. This is by design. A valid response is a map with a :status. I think the doc-string for the default not-found interceptor can be improved since "An interceptor that returns a 404 when routing failed to resolve a route." does not fully capture this behavior.

ikitommi17:08:03

Are there any examples of writing an alternative router impl for Pedestal?

ikitommi17:08:33

the default router says:

(defprotocol RouterSpecification
  (router-spec [specification router-ctor]
    "Returns an interceptor which attempts to match each route against
    a :request in context. For the first route that matches, it will:
    - enqueue the matched route's interceptors
    - associate the route into the context at :route
    - associate a map of :path-params into the :request
  If no route matches, returns context with :route nil."))

ikitommi17:08:37

how is the :route used by other components? I don’t think I would have anything like that (or at least in a format pedestal would understand). Is it ok just to push :path-params and enqueue the interceptors?

ddeaguiar17:08:22

@U055NJ5CC I don’t have the answers to this question. Try asking in the Pedestal Users group as well?

ikitommi17:08:52

also, if a route is matched, but a handler returns nil,. do I check this in the :leave by checking that there is a :response and it's nil, right?

ikitommi17:08:46

seems so, by looking at the not-found mentioned here

lxsameer19:08:39

hey folks what's the correct way to merge to vector of interceptors ? is there any helper function ?

ddeaguiar20:08:47

@lxsameer I’ve found the core collection fns to be sufficient. It’s just data

lxsameer20:08:07

but it's not gonna eliminate the duplicates , is it ?

ddeaguiar20:08:41

nope, you do need to write that. There are no helpers that I know of

lxsameer20:08:51

thanks buddy