mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 00:11:11 +00:00
Add test to validate middleware cannot be list
When meta-merges list with a vector, the resulting order is reversed. To avoid this for the middleware chain, middleware cannot be lists.
This commit is contained in:
parent
eeeba281ac
commit
4a199b918a
1 changed files with 9 additions and 1 deletions
|
|
@ -77,7 +77,15 @@
|
|||
:data {:middleware [{:spec (s/keys :opt-un [::roles])
|
||||
:wrap (fn [handler]
|
||||
(fn [request]
|
||||
(handler request)))}]}})))))
|
||||
(handler request)))}]}}))))
|
||||
(testing "middleware cannot be a list"
|
||||
(is (thrown-with-msg?
|
||||
ExceptionInfo
|
||||
#":reitit.ring.spec/invalid-specs"
|
||||
(ring/router
|
||||
["/api" {:handler identity
|
||||
:middleware '()}]
|
||||
{:validate rrs/validate})))))
|
||||
|
||||
(deftest coercion-spec-test
|
||||
(is (r/router?
|
||||
|
|
|
|||
Loading…
Reference in a new issue