-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
You can currently define duplicate named parameters in the route with the last one resolved being the end value. E.g. given the following:
#[test]
fn duplicate_key() {
let mut router = Router::new();
router.add("/foo/:bar/*bar", "test".to_string());
let m = router.recognize("/foo/blah/this/is/the/rest").unwrap();
assert_eq!(*m.handler, "test".to_string());
assert_eq!(m.params, params("bar", "blah"));
}
this fails with:
thread 'duplicate_key' panicked at 'assertion failed: `(left == right)`
left: `Params { map: {"bar": "this/is/the/rest"} }`,
right: `Params { map: {"bar": "blah"} }`', src\lib.rs:339:5
This should probably be prevented when the route is created - given that you can define nameless parameters I can't see a reason for needing to have duplicate names.
Metadata
Metadata
Assignees
Labels
No labels