Any idea why this would not work? It works if I just add (assoc api-config :middleware [wrap-reload wrap-with-logger])
, however it's not working when I want to wrap in conditional like this
(defn wrap-logger
"Wraps logger for each API and websocket request"
[handler]
(fn [request]
(if-url-starts-with handler ["/api" "/websocket"]
#(wrap-with-logger % {:redact-keys #{:user_token}
:redact-value "******"}))))
(defn create-handler
[]
(api
(assoc api-config :middleware [wrap-reload wrap-logger])
Wed Feb 28 16:29:20 UTC 2018 [worker-1] ERROR - GET /
java.lang.ClassCastException: ring.middleware.conditional$if$fn__3263 cannot be cast to java.util.Map
Thanks for a hint 🙂