Fork me on GitHub
#pedestal
<
2019-10-09
>
dadair15:10:43

Hey, so I'm running into some behaviour that I can't quite explain. I have two routes defined in table syntax: #{["/foos/search" :get [..] :route-name :search] ["/foos/:foo-id/bar" :post [..] :route-name :bar]}; the presence of the second route makes the system return a 404 for the first. This leads me to believe they are conflicting, but both the verbs and the route-names are different? I can't seem to explain this. We are on io.pedestal/pedestal.route {:mvn/version "0.5.3"}.

ikitommi16:10:00

@dadair it's by design: > The prefix-tree router also changes some of the routing behavior. In the linear-search, you could have routes like /one/:wild and /one/two, the latter being a hard match and the former picking up any wildcard URL matches (not /one/two). In the prefix-tree, this isn't allowed, and one/:wild will always be matched. This change also encourages "best practices" and removes the possibility of subtle bugs introduced by human error.

ddeaguiar16:10:38

@dadair refer to http://pedestal.io/reference/using-the-builtin-routers. You’ll want to use the Linear Search router instead

dadair16:10:44

Ah ok thank you; the reference docs on the website are a bit misleading, they state (iirc) that as long as verb and name differ, there is no collision

dadair16:10:57

I’ll take a look at the other routers

isak16:10:29

couldn't one just be linear for that part of the tree?