Fork me on GitHub
#pedestal
<
2017-10-20
>
Cesco16:10:13

Hi guys, I’m new here 😄 I have a question about the short-circuit logic. It seems to be not working in the way I understand it. I’m on 0.5.3 and if I try to return a response from any interceptor, the next one is called and ends up overriding the already set response.

Cesco16:10:17

Is there anything that needs to be enabled in order to make it work as it’s written on the docs? I already spent few hours on this without finding a solution

jjttjj17:10:44

@francesco686 are you calling io.pedestal.interceptor.chain/terminate prior to providing the response? Like this:

(if-not (= id expected-id)
  (-> context
      io.pedestal.interceptor.chain/terminate
      (assoc :response {:status 401 :body {:message "Unauthorized"}})))

Cesco19:10:14

@jjttjj no, I thought this step was not need. Also going back to the 24th of March, some guys in this channel were actually saying it was not needed. Link: https://clojurians-log.clojureverse.org/pedestal/2017-03-24.html

Cesco19:10:56

ah, found out, I was missing the :headers key on the response object. Without that, the terminator interceptor is not injected.