diff options
Diffstat (limited to 'web/atward')
-rw-r--r-- | web/atward/src/main.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/web/atward/src/main.rs b/web/atward/src/main.rs index e412def4a969..aef41a29b4e7 100644 --- a/web/atward/src/main.rs +++ b/web/atward/src/main.rs @@ -63,7 +63,12 @@ fn main() { rouille::start_server(&address, move |request| { rouille::log(&request, std::io::stderr(), || { - match dispatch(&queries, &request.url()) { + let query = match request.get_param("q") { + Some(q) => q, + None => return fallback(), + }; + + match dispatch(&queries, &query) { None => fallback(), Some(destination) => Response::redirect_303(destination), } @@ -93,7 +98,10 @@ mod tests { Some("https://cl.tvl.fyi/42".to_string()) ); - assert_eq!(dispatch(&queries(), "something only mentioning cl/42"), None,); + assert_eq!( + dispatch(&queries(), "something only mentioning cl/42"), + None, + ); assert_eq!(dispatch(&queries(), "cl/invalid"), None,); } } |