reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
jkent 2020-04-08T15:43:27.081800Z

I’m moving over an existing api from compojure-api to reitit and we have multiple http methods with the same path. I’ve added {:conflicts nil} which resolves the compilation error but only one of my endpoints are working. A distilled example:

["/api/attachments"
        {:swagger {:tags ["attachments"]}}

        ["/"
         {:get {:summary "downloads an attachment"
                :handler (fn [_]
                           {:status 200
                            :body   {:hello "world"}})}}]

        ["/"
         {:post {:summary "uploads an attachment"
                 :handler (fn [_]
                            {:status 200
                             :body   {:hello "world"}})}}]

        ]

ikitommi 2020-04-08T15:46:26.082900Z

@jkent you need to add both :get and :post to same path.

jkent 2020-04-08T15:47:35.083700Z

thanks for the quick reply. I’ll give that a go

ikitommi 2020-04-08T15:48:38.085400Z

by design, if a there is a full match on a path, no other paths are looked. Also, you can remove the :conflicts with that.

jkent 2020-04-08T15:56:41.085900Z

thank you. that resolved my issue