Dancer2
Dancer2 copied to clipboard
Routes with mixed inline regexs and tokens
When working on #1641, I planned on adding a test case for get '/(any|some)/thing/:id => sub {...};
to t/classes/Dancer2-Core-Route/match.t, which fails :(
+ [
+ [ 'get', '/(any|some)/thing/:id', sub {61} ],
+ '/some/thing/else',
+ [ { id => 'else', splat => ['some'] }, 61 ]
+ ],
The route matching code extracts the values some
and else
from the path; but the route regexp only has one regex with a comment. The token assignment iterates through the regex captures starting with those with comments first, assigning the rest to splat
. This results in the params { id => 'some', splat => ['else'] }
.. which is just wrong.
After some though, I still do not have a way to "fix" this. Creating this issue as a reminder to myself, or in hope someone else may pick it up 🤞 .