I've got these two routes: ``` /foo:{bar}/{baz} /{...
# ktor
r
I've got these two routes:
Copy code
/foo:{bar}/{baz}
/{bar}/{baz}
When calling
/foo:123/456
I was expecting the first route to trigger with bar=123 and baz=456. Instead, the second route triggers with bar=foo:123 and baz=456. Is this a bug or expected?
d
Interesting, does the order of declaration change anything?
r
Didn't try, I assumed the first one would take priority if it mattered. The trace just shows both routes as matching, and doesn't indicate any type of ordered resolution.
m
Don’t have routes that overlap? 🤷‍♂️ Even if you manage to configure this so it works, the next human that looks at the system is probably going to be confused one way or another
r
Its actually not that confusing in the actual implementation, due to the naming i.e. the second route has completely different param names.
That being said, yeah, I've already changed the route to
/foo/{bar}/{baz}
but due to the nature of the
bar
value this actually makes a lot less sense.
m
ah well. HTTP has its limitations 😕
r
It does indeed, but I'm not sure this case falls into that category. I'm not going to lose sleep over it though :)
Ok, I did lose a little sleep over it 🙂 I found the issue a bit more nuanced than I earlier reported -- the second path is only chosen first if it is surrounded in an
authenticate
block (perhaps other wrappers too, I didn't check). Created this issue: https://github.com/ktorio/ktor/issues/1158
m
interesting