reitit

Mia 2024-06-26T16:57:35.651589Z

@ikitommi, when you come back from vacation, this has stumped @ambrosebs and me

👌 1
manderson 2024-06-26T19:57:06.020689Z

I have a route with some data on it where the value is a clojure record. It seems that when I pass that route through reitit.ring/router it converts it to a regular map. Any idea why that would be? How can I preserve the record? This is reitit-ring 0.7.0 EG:

(defrecord FooTest [a b])
=> repl.FooTest

(reitit.core/match-by-path
 (reitit.ring/router
  ["/api/foo" {:get {:handler (constantly {:status 200})
                     :test (->FooTest 1 22)}}])
 "/api/foo")
=> #reitit.core.Match{:template "/api/foo", :data {:get {:handler #function[clojure.core/constantly/fn--5740], :test {:a 1, :b 22}}}, :result #reitit.ring.Methods{:get #reitit.ring.Endpoint{:data {:handler #function[clojure.core/constantly/fn--5740], :test {:a 1, :b 22}}, :handler #function[clojure.core/constantly/fn--5740], :path "/api/foo", :method :get, :middleware []}, :head nil, :post nil, :put nil, :delete nil, :connect nil, :options #reitit.ring.Endpoint{:data {:no-doc true, :handler #function[reitit.ring/fn--28003/fn--28012]}, :handler #function[reitit.ring/fn--28003/fn--28012], :path "/api/foo", :method :options, :middleware []}, :trace nil, :patch nil}, :path-params {}, :path "/api/foo"}

manderson 2024-06-26T21:14:46.629959Z

FYI: opened an issue: https://github.com/metosin/reitit/issues/686

ikitommi 2024-06-28T12:11:52.308899Z

thanks for reporting. this is a bug, assigned to myself

1