reitit 2024-06-26

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

👌 1

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"}

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

1