Fork me on GitHub
#reitit
<
2020-04-08
>
jkent15:04:27

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

        ]

ikitommi15:04:26

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

jkent15:04:35

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

ikitommi15:04:38

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.

jkent15:04:41

thank you. that resolved my issue