mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 00:11:11 +00:00
Fix #216
This commit is contained in:
parent
bd11b6032d
commit
b1bef1c1cc
5 changed files with 45 additions and 29 deletions
|
|
@ -9,6 +9,14 @@
|
||||||
controller is interested in, as data, which should cover most
|
controller is interested in, as data, which should cover most
|
||||||
use cases: `{:start start-fn, :parameters {:path [:foo-id]}}`
|
use cases: `{:start start-fn, :parameters {:path [:foo-id]}}`
|
||||||
|
|
||||||
|
## `reitit-ring`
|
||||||
|
|
||||||
|
* Allow Middleware to compile to `nil` with Middleware Registries, fixes to [#216](https://github.com/metosin/reitit/issues/216).
|
||||||
|
|
||||||
|
## `reitit-http`
|
||||||
|
|
||||||
|
* Allow Interceptors to compile to `nil` with Interceptor Registries, related to [#216](https://github.com/metosin/reitit/issues/216).
|
||||||
|
|
||||||
## 0.2.13 (2019-01-26)
|
## 0.2.13 (2019-01-26)
|
||||||
|
|
||||||
* Don't throw `StringIndexOutOfBoundsException` with empty path lookup on wildcard paths, fixes [#209](https://github.com/metosin/reitit/issues/209)
|
* Don't throw `StringIndexOutOfBoundsException` with empty path lookup on wildcard paths, fixes [#209](https://github.com/metosin/reitit/issues/209)
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
#?(:clj clojure.lang.Keyword
|
#?(:clj clojure.lang.Keyword
|
||||||
:cljs cljs.core.Keyword)
|
:cljs cljs.core.Keyword)
|
||||||
(into-interceptor [this data {:keys [::registry] :as opts}]
|
(into-interceptor [this data {:keys [::registry] :as opts}]
|
||||||
(or (if-let [interceptor (if registry (registry this))]
|
(if-let [interceptor (if registry (registry this))]
|
||||||
(into-interceptor interceptor data opts))
|
(into-interceptor interceptor data opts)
|
||||||
(throw
|
(throw
|
||||||
(ex-info
|
(ex-info
|
||||||
(str
|
(str
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@
|
||||||
#?(:clj clojure.lang.Keyword
|
#?(:clj clojure.lang.Keyword
|
||||||
:cljs cljs.core.Keyword)
|
:cljs cljs.core.Keyword)
|
||||||
(into-middleware [this data {:keys [::registry] :as opts}]
|
(into-middleware [this data {:keys [::registry] :as opts}]
|
||||||
(or (if-let [middleware (if registry (registry this))]
|
(if-let [middleware (if registry (registry this))]
|
||||||
(into-middleware middleware data opts))
|
(into-middleware middleware data opts)
|
||||||
(throw
|
(throw
|
||||||
(ex-info
|
(ex-info
|
||||||
(str
|
(str
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,10 @@
|
||||||
#"Interceptor :enter not found in registry"
|
#"Interceptor :enter not found in registry"
|
||||||
(create [:enter]))))
|
(create [:enter]))))
|
||||||
|
|
||||||
|
(testing "existing keyword, compiling to nil"
|
||||||
|
(let [app (create [:enter] {::interceptor/registry {:enter {:compile (constantly nil)}}})]
|
||||||
|
(is (= [:ok] (app ctx)))))
|
||||||
|
|
||||||
(testing "as map"
|
(testing "as map"
|
||||||
(reset! calls 0)
|
(reset! calls 0)
|
||||||
(let [app (create [{:enter (:enter (enter :value))}])]
|
(let [app (create [{:enter (:enter (enter :value))}])]
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,10 @@
|
||||||
#"Middleware :wrap not found in registry"
|
#"Middleware :wrap not found in registry"
|
||||||
(create [:wrap]))))
|
(create [:wrap]))))
|
||||||
|
|
||||||
|
(testing "existing keyword, compiling to nil"
|
||||||
|
(let [app (create [:wrap] {::middleware/registry {:wrap {:compile (constantly nil)}}})]
|
||||||
|
(is (= [:ok] (app request)))))
|
||||||
|
|
||||||
(testing "as function vector with value(s)"
|
(testing "as function vector with value(s)"
|
||||||
(reset! calls 0)
|
(reset! calls 0)
|
||||||
(let [app (create [[wrap :value]])]
|
(let [app (create [[wrap :value]])]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue