mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 00:11:11 +00:00
Merge pull request #275 from kwrooijen/fix-coercion-spec-problems-key
Properly access ::s/problems key in coercion-spec
This commit is contained in:
commit
56a5a4a56f
2 changed files with 4 additions and 2 deletions
|
|
@ -110,7 +110,7 @@
|
||||||
(into-spec model name))
|
(into-spec model name))
|
||||||
(-open-model [_ spec] spec)
|
(-open-model [_ spec] spec)
|
||||||
(-encode-error [_ error]
|
(-encode-error [_ error]
|
||||||
(let [problems (::s/problems error)]
|
(let [problems (-> error :problems ::s/problems)]
|
||||||
(-> error
|
(-> error
|
||||||
(update :spec (comp str s/form))
|
(update :spec (comp str s/form))
|
||||||
(assoc :problems (mapv #(update % :pred stringify-pred) problems)))))
|
(assoc :problems (mapv #(update % :pred stringify-pred) problems)))))
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,9 @@
|
||||||
(app valid-request))))
|
(app valid-request))))
|
||||||
|
|
||||||
(testing "invalid request"
|
(testing "invalid request"
|
||||||
(let [{:keys [status]} (app invalid-request)]
|
(let [{:keys [status body]} (app invalid-request)
|
||||||
|
problems (:problems body)]
|
||||||
|
(is (= 1 (count problems)))
|
||||||
(is (= 400 status))))
|
(is (= 400 status))))
|
||||||
|
|
||||||
(testing "invalid response"
|
(testing "invalid response"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue