diff options
| author | Fuwn <[email protected]> | 2022-03-26 09:43:42 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-03-26 09:43:42 +0000 |
| commit | a436ec3dee22fcf58d9ce1e7b6bbba7766aabd79 (patch) | |
| tree | a0826d014e317753cd580b9f0d56e8c523130e41 /examples/windmark.rs | |
| parent | feat(response): temporary failure response (diff) | |
| download | windmark-a436ec3dee22fcf58d9ce1e7b6bbba7766aabd79.tar.xz windmark-a436ec3dee22fcf58d9ce1e7b6bbba7766aabd79.zip | |
feat(response): inputs
Diffstat (limited to 'examples/windmark.rs')
| -rw-r--r-- | examples/windmark.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/windmark.rs b/examples/windmark.rs index 391b13e..f45c9a7 100644 --- a/examples/windmark.rs +++ b/examples/windmark.rs @@ -81,5 +81,19 @@ fn main() -> std::io::Result<()> { .mount("/param/:lang", |_, _url, dynamic_parameter| { Response::Success(format!("Parameter lang is {:?}", dynamic_parameter)) }) + .mount("/input", |_, url, _| { + if let Some(name) = url.query() { + Response::Success(format!("Your name is {}!", name)) + } else { + Response::Input("What is your name?".into()) + } + }) + .mount("/sensitive-input", |_, url, _| { + if let Some(password) = url.query() { + Response::Success(format!("Your password is {}!", password)) + } else { + Response::SensitiveInput("What is your password?".into()) + } + }) .run() } |