This commit is contained in:
Tommi Reiman 2020-05-09 17:18:17 +03:00
parent 79c430d298
commit b8b442b598
3 changed files with 20 additions and 7 deletions

View file

@ -28,6 +28,10 @@ is called the first time, so that `rfe/push-state` and such can be called
[metosin/malli "0.0.1-20200404.091302-14"] is available but we use "0.0.1-20200305.102752-13" [metosin/malli "0.0.1-20200404.091302-14"] is available but we use "0.0.1-20200305.102752-13"
``` ```
### `reitit-ring`
* `reitit.ring/routes` strips away `nil` routes, fixes [#394](https://github.com/metosin/reitit/issues/394)
## 0.4.2 (2020-01-17) ## 0.4.2 (2020-01-17)
### `reitit` ### `reitit`

View file

@ -108,7 +108,7 @@
(defn routes (defn routes
"Create a ring handler by combining several handlers into one." "Create a ring handler by combining several handlers into one."
[& handlers] [& handlers]
(let [single-arity (apply some-fn handlers)] (let [single-arity (apply some-fn (keep identity handlers))]
(fn (fn
([request] ([request]
(single-arity request)) (single-arity request))

View file

@ -24,6 +24,15 @@
([request respond _] ([request respond _]
(respond (handler request)))) (respond (handler request))))
(deftest routes-test
(testing "nils are removed"
(is (= 123
((ring/routes
(constantly nil)
nil
(constantly 123))
::irrelevant)))))
(deftest ring-router-test (deftest ring-router-test
(testing "all paths should have a handler" (testing "all paths should have a handler"