This commit is contained in:
Tommi Reiman 2018-07-27 15:10:02 +03:00
parent e879e66f26
commit 055a03c793
2 changed files with 17 additions and 11 deletions

View file

@ -24,11 +24,14 @@
(defn handler [ctx] (defn handler [ctx]
(conj ctx :ok)) (conj ctx :ok))
(defn create [interceptors] (defn create
(let [chain (interceptor/chain ([interceptors]
interceptors (create interceptors nil))
handler :data nil)] ([interceptors opts]
(partial execute chain))) (let [chain (interceptor/chain
interceptors
handler :data opts)]
(partial execute chain))))
(deftest expand-interceptor-test (deftest expand-interceptor-test

View file

@ -10,12 +10,15 @@
(defn handler [request] (defn handler [request]
(conj request :ok)) (conj request :ok))
(defn create [middleware] (defn create
(middleware/chain ([middleware]
middleware (create middleware nil))
handler ([middleware opts]
:data (middleware/chain
nil)) middleware
handler
:data
opts)))
(deftest expand-middleware-test (deftest expand-middleware-test