don't merge records

This commit is contained in:
Tommi Reiman 2024-06-29 16:21:28 +03:00
parent d136975154
commit 2da94f733d
2 changed files with 15 additions and 1 deletions

View file

@ -29,7 +29,7 @@
f (-match p' path-map)]
(cond
f (conj l [p' (f v)])
(and (map? v) (seq v)) (-path-vals l p' v)
(and (map? v) (not (record? v)) (seq v)) (-path-vals l p' v)
:else (conj l [p' v]))))
l m))]
(-path-vals [] [] m)))

View file

@ -760,3 +760,17 @@
(is (= (r "2") (app {:uri "/", :request-method :get})))
(def routes ["/" (constantly (r "3"))]) ;; redefine again
(is (= (r "3") (app {:uri "/", :request-method :get}))))))))
(defrecord FooTest [a b])
(deftest path-update-fix-686
(testing "records are retained"
(is (= true (-> ["/api/foo" {:get {:handler (constantly {:status 200})
:test (FooTest. 1 2)}}]
(ring/router)
(r/compiled-routes)
(first)
(second)
:get
:test
(record?))))))