You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use defmulti to dispatch API actions on a map key. To avoid needing to wrap that defmulti in a normal function, so that it can be used as a Reitit ring handler, these two protocols need to be extended. In the sample code below, all I did was repeat the clojure.lang.Fn implementation.
(extend-protocol reitit.core/Expand
clojure.lang.MultiFn
(expand [this _] {:handler this}))
(extend-protocol reitit.interceptor/IntoInterceptor
clojure.lang.MultiFn
(into-interceptor [this data opts]
(reitit.interceptor/into-interceptor
{:name:reitit.interceptor/handler::handler this
:enter (fn [ctx]
(assoc ctx :response (this (:request ctx))))}
data opts)))
The text was updated successfully, but these errors were encountered:
We use
defmulti
to dispatch API actions on a map key. To avoid needing to wrap thatdefmulti
in a normal function, so that it can be used as a Reitit ring handler, these two protocols need to be extended. In the sample code below, all I did was repeat theclojure.lang.Fn
implementation.The text was updated successfully, but these errors were encountered: