Fork me on GitHub
#reitit
<
2022-06-06
>
anthony-galea12:06:02

hi, has anyone used reitit to handle custom methods as described here: https://cloud.google.com/apis/design/custom_methods if I have something like:

(def routes
  [["/foo/{name}" :foo]
   ["/foo/{name}:custom" :foo-custom-verb]
   ["/foo/{name}/bar/{subname}" :foo-bar]])

(router routes {:syntax :bracket})
I get an exception at router creation:
{:terminators (":custom" "/bar/"), :path "/foo/{name}"}
{:type :reitit.trie/multiple-terminators,
 :data {:terminators (":custom" "/bar/"), :path "/foo/{name}"}, ...

Ferdinand Beyer13:06:18

Sorry for my now deleted reply 🙂 Looks like your routes contain conflicts, as /foo/bar:custom could match /foo/{name} with name = "bar:custom" and /foo/{name}:custom. Try conflict resolution: https://cljdoc.org/d/metosin/reitit/0.5.18/doc/basics/route-conflicts