Fork me on GitHub

hello, i have an overall question about interceptors. if you have an interceptor that depends on another interceptor is there a way that’s represented? i was thinking that the dependency could be enforced by checking if the expected value is there and if not, then inject the required interceptor. is there some better way? Basically what I’m doing now is:

(def my-interceptor
  {:enter (fn [{:keys [required-key] :as ctx}]
            (if (nil? required-key)
              (inject-then-reexecute ctx required-key-interceptor)
              (continue-with-execution ctx)))})
And inject-then-reexecute will move the current interceptor from the stack back to the queue and then add whatever the dependency interceptor is


I would consider the missing interceptor a bug, so if anything, I'd throw an exception stating exactly that ("missing xyz in context. Is interceptor-xyz setup?")


Thanks! That makes sense. I like that better!


i wrote a little library many years ago to help deal with this


Awesome, thanks for sharing! Will check it out