(compile named-chain handler-fn)
Returns a fn that exercises a chain of interceptor-tuples against a task and returns a result. Uses metosin/siepppari under the hood.
Returns a fn that exercises a chain of interceptor-tuples against a task and returns a result. Uses metosin/siepppari under the hood.
(well-formed-interceptor-tuple? interceptor-tuple)
Interceptor-tuple should be a tuple of the form, [:name {:enter (fn [ctx] ... (update ctx :request myfn1)) :leave (fn [ctx] ... (update ctx :response myfn2))}]
A few notes:
:enter
and :leave
functions need to return ctx
or an updated
version of ctx
for the next interceptor in the chain:enter
or :leave
fn can be nil if not used:request
for :enter
fn:response
for :leave
fn.Reference: https://github.com/metosin/sieppari
Interceptor-tuple should be a tuple of the form, [:name {:enter (fn [ctx] ... (update ctx :request myfn1)) :leave (fn [ctx] ... (update ctx :response myfn2))}] A few notes: 1. `:enter` and `:leave` functions need to return `ctx` or an updated version of `ctx` for the next interceptor in the chain 2. either `:enter` or `:leave` fn can be nil if not used 3. incoming data are tucked away in `:request` for `:enter` fn 4. outgoing data are in `:response` for `:leave` fn. Reference: https://github.com/metosin/sieppari
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close