diff options
| author | Fuwn <[email protected]> | 2022-04-07 03:58:20 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-04-07 03:58:20 +0000 |
| commit | b9ec54b81abb193b2fc19d24ceec25d603ca2431 (patch) | |
| tree | 40ee65c8eda206fcce6654321c34f0aa0527a4a1 | |
| parent | fix: try to fix path (diff) | |
| download | windmark-b9ec54b81abb193b2fc19d24ceec25d603ca2431.tar.xz windmark-b9ec54b81abb193b2fc19d24ceec25d603ca2431.zip | |
fix: trailing for fix
| -rw-r--r-- | examples/windmark.rs | 3 | ||||
| -rw-r--r-- | src/lib.rs | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/examples/windmark.rs b/examples/windmark.rs index 2a0f682..c3ce6ac 100644 --- a/examples/windmark.rs +++ b/examples/windmark.rs @@ -199,6 +199,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { ) }) }); + // router.mount("", Box::new(|_| { + // Response::Success("hi".into()) + // })); router.run().await } @@ -365,7 +365,11 @@ impl Router { let fixed_path = if self.fix_path { self .routes - .fix_path(url.path()) + .fix_path(if url.path().is_empty() { + "/" + } else { + url.path() + }) .unwrap_or_else(|| url.path().to_string()) } else { url.path().to_string() |