🏗️ Elegant & Highly Performant Async Gemini Server Framework for the Modern Age
async framework gemini-protocol protocol gemini rust
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(router): Add case-insensitive route matching option

Fuwn 6544d0dc 74ce57c0

+16 -2
+5 -2
examples/fix_path.rs
··· 17 17 18 18 //! `cargo run --example fix_path --features response-macros` 19 19 20 + use windmark::router_option::RouterOption; 21 + 20 22 #[windmark::main] 21 23 async fn main() -> Result<(), Box<dyn std::error::Error>> { 22 24 windmark::router::Router::new() 23 25 .set_private_key_file("windmark_private.pem") 24 26 .set_certificate_file("windmark_public.pem") 25 27 .add_options(&[ 26 - windmark::router_option::RouterOption::RemoveExtraTrailingSlash, 27 - windmark::router_option::RouterOption::AddMissingTrailingSlash, 28 + RouterOption::RemoveExtraTrailingSlash, 29 + RouterOption::AddMissingTrailingSlash, 30 + RouterOption::AllowCaseInsensitiveLookup, 28 31 ]) 29 32 .mount( 30 33 "/close",
+8
src/router.rs
··· 421 421 } 422 422 423 423 let mut path = url.path().to_string(); 424 + 425 + if self 426 + .options 427 + .contains(&RouterOption::AllowCaseInsensitiveLookup) 428 + { 429 + path = path.to_lowercase(); 430 + } 431 + 424 432 let mut route = self.routes.at(&path); 425 433 426 434 if route.is_err() {
+3
src/router_option.rs
··· 7 7 /// If enabled, adds a trailing slash to the request URL path if a route 8 8 /// exists for the path with the slash (e.g., `/foo` becomes `/foo/`). 9 9 AddMissingTrailingSlash, 10 + /// If enabled, the router will perform case-insensitive matching for 11 + /// incoming request URL paths (e.g., `/foo` will match `/Foo` or `/FOO`). 12 + AllowCaseInsensitiveLookup, 10 13 }