dynamic prefixes should not be able match without a slash seperator
robjtede opened this issue · 0 comments
robjtede commented
Good! Now we have to find a solution for dynamic prefixes. One idea is to implement it in regex, where each dynamic prefix pattern is put inside a capture group with a pattern to detect segment boundary:
(original_regex_pattern)[/$]
. But this may add complexity. I'm not sure.
Originally posted by @aliemjay in #373 (comment)
test case that should not work but does:
let resource = ResourceDef::prefix(r"/id/{id:\d{3}}");
assert!(resource.is_match("/id/1234"));
assert_eq!(resource.find_match("/id/1234"), Some(7));