From d1369751542daa7e365430e1ca06e779862550fe Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sat, 29 Jun 2024 16:20:44 +0300 Subject: [PATCH 1/7] format --- test/cljc/reitit/core_test.cljc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/cljc/reitit/core_test.cljc b/test/cljc/reitit/core_test.cljc index 14ae06d0..8c9b31c5 100644 --- a/test/cljc/reitit/core_test.cljc +++ b/test/cljc/reitit/core_test.cljc @@ -250,9 +250,9 @@ (is result) (is (= "ok" (result)))) (testing "var handler gets expanded" - (let [router (r/router ["/ping" #'var-handler]) - {:keys [result]} (r/match-by-path router "/ping")] - (is (= #'var-handler result)))))) + (let [router (r/router ["/ping" #'var-handler]) + {:keys [result]} (r/match-by-path router "/ping")] + (is (= #'var-handler result)))))) (testing "custom router" (let [router (r/router ["/ping"] {:router (fn [_ _] @@ -423,7 +423,7 @@ (r/expand [_ _] {:name n})) (deftest default-expand-test - (let [router (r/router ["/endpoint" (->Named :kikka)])] + (let [router (r/router ["/endpoint" (Named. :kikka)])] (is (= [["/endpoint" {:name :kikka}]] (r/routes router))))) From 2da94f733d6924d6c22327b908a40f29f721f2bb Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sat, 29 Jun 2024 16:21:28 +0300 Subject: [PATCH 2/7] don't merge records --- modules/reitit-core/src/reitit/impl.cljc | 2 +- test/cljc/reitit/ring_test.cljc | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/reitit-core/src/reitit/impl.cljc b/modules/reitit-core/src/reitit/impl.cljc index 9afd570a..70e36119 100644 --- a/modules/reitit-core/src/reitit/impl.cljc +++ b/modules/reitit-core/src/reitit/impl.cljc @@ -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))) diff --git a/test/cljc/reitit/ring_test.cljc b/test/cljc/reitit/ring_test.cljc index e00b52d7..c38bb69e 100644 --- a/test/cljc/reitit/ring_test.cljc +++ b/test/cljc/reitit/ring_test.cljc @@ -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?)))))) From eb4c231c23b3ed05997157d1581b7343f273f608 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sat, 29 Jun 2024 16:21:35 +0300 Subject: [PATCH 3/7] format --- test/cljc/reitit/ring_test.cljc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/cljc/reitit/ring_test.cljc b/test/cljc/reitit/ring_test.cljc index c38bb69e..59c675db 100644 --- a/test/cljc/reitit/ring_test.cljc +++ b/test/cljc/reitit/ring_test.cljc @@ -738,9 +738,9 @@ {::trie/trie-compiler compiler})] (dotimes [_ 10] (future - (dotimes [n 100000] - (let [body (:body (app {:request-method :get, :uri (str "/" n)}))] - (is (= body (str n)))))))))))) + (dotimes [n 100000] + (let [body (:body (app {:request-method :get, :uri (str "/" n)}))] + (is (= body (str n)))))))))))) (declare routes) From 77f0798c060641409c7eee21eeb6cdf947d03b99 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sat, 29 Jun 2024 16:22:31 +0300 Subject: [PATCH 4/7] . --- test/cljc/reitit/ring_test.cljc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/cljc/reitit/ring_test.cljc b/test/cljc/reitit/ring_test.cljc index 59c675db..78243c74 100644 --- a/test/cljc/reitit/ring_test.cljc +++ b/test/cljc/reitit/ring_test.cljc @@ -765,12 +765,12 @@ (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?)))))) + (is (true? (-> ["/api/foo" {:get {:handler (constantly {:status 200}) + :test (FooTest. 1 2)}}] + (ring/router) + (r/compiled-routes) + (first) + (second) + :get + :test + (record?)))))) From 129de37d3ec4b86dbbb760f88a638d57d1d538a8 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sat, 29 Jun 2024 16:23:35 +0300 Subject: [PATCH 5/7] . --- test/cljc/reitit/ring_test.cljc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/cljc/reitit/ring_test.cljc b/test/cljc/reitit/ring_test.cljc index 78243c74..c0e7412c 100644 --- a/test/cljc/reitit/ring_test.cljc +++ b/test/cljc/reitit/ring_test.cljc @@ -765,12 +765,11 @@ (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?)))))) + (is (record? (-> ["/api/foo" {:get {:handler (constantly {:status 200}) + :test (FooTest. 1 2)}}] + (ring/router) + (r/compiled-routes) + (first) + (second) + :get + :test))))) From c792a6b79477ab27ced9b6b2ac5484a3a0e94467 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Sat, 29 Jun 2024 16:27:10 +0300 Subject: [PATCH 6/7] updated deps --- CHANGELOG.md | 11 +++++++++++ project.clj | 24 ++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cb600b6..19bd45ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,17 @@ We use [Break Versioning][breakver]. The version numbers follow a `. Date: Sat, 29 Jun 2024 16:27:47 +0300 Subject: [PATCH 7/7] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19bd45ec..e283de98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ We use [Break Versioning][breakver]. The version numbers follow a `.