Closed CathalMullan closed 1 month ago
Following test fails.
#[test] fn test() -> Result<(), Box<dyn Error>> { let mut router = Router::new(); router.insert("/{file}", 1)?; router.insert("/{file}.{extension}", 1)?; let path = Path::new("/readme")?; let search = router.search(&path)?.unwrap(); assert_eq!(*search.data, 1); assert_eq!(search.parameters[0].key, "file"); assert_eq!(search.parameters[0].value, "readme"); let path = Path::new("/report.pdf")?; let search = router.search(&path)?.unwrap(); assert_eq!(*search.data, 1); assert_eq!(search.parameters[0].key, "file"); assert_eq!(search.parameters[0].value, "report"); assert_eq!(search.parameters[1].key, "extension"); assert_eq!(search.parameters[1].value, "pdf"); Ok(()) }
▽ ╰─ / ╰─ {file} ○ ╰─ . ╰─ {extension} ○
We'd expect the second Path to route to /{file}.{extension}, but it routes to /{file} instead.
Path
/{file}.{extension}
/{file}
We need some way to ensure we try deeper nodes on the same 'branch'.
Following test fails.
We'd expect the second
Path
to route to/{file}.{extension}
, but it routes to/{file}
instead.We need some way to ensure we try deeper nodes on the same 'branch'.