Fixed bug where root handler was never hit for requests other than exact matches

This commit is contained in:
Emi Tatsuo 2020-11-19 23:34:45 -05:00
parent b085fa5836
commit 54816e1f67
Signed by: Emi
GPG Key ID: 68FAB2E2E6DFC98B
2 changed files with 5 additions and 2 deletions

View File

@ -48,6 +48,7 @@ fn generate_doc(route_name: &str) -> Document {
.add_link_without_label("/") .add_link_without_label("/")
.add_link_without_label("/route") .add_link_without_label("/route")
.add_link_without_label("/route/long") .add_link_without_label("/route/long")
.add_link_without_label("/route/not_real"); .add_link_without_label("/route/not_real")
.add_link_without_label("/rowte");
doc doc
} }

View File

@ -93,7 +93,9 @@ impl RoutingNode {
let mut node = self; let mut node = self;
for segment in path.segments() { for segment in path.segments() {
node = node.1.entry(segment.to_string()).or_default(); if segment != "" {
node = node.1.entry(segment.to_string()).or_default();
}
} }
if node.0.is_some() { if node.0.is_some() {