diff options
| author | Fuwn <[email protected]> | 2022-07-09 01:03:10 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-07-09 01:03:10 +0000 |
| commit | c44562486a876903957c442586dd6fa13ac9faeb (patch) | |
| tree | 9c41fb843ac682e42173f00569a3e7c358e18e57 /examples | |
| parent | docs(cargo): bump version 0.1.15 -> 0.1.16 (diff) | |
| download | windmark-0.1.17.tar.xz windmark-0.1.17.zip | |
feat(response): always allow explicit mime specificationv0.1.17
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/windmark.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/windmark.rs b/examples/windmark.rs index eaf7b43..80b0cba 100644 --- a/examples/windmark.rs +++ b/examples/windmark.rs @@ -58,6 +58,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { router.set_private_key_file("windmark_private.pem"); router.set_certificate_file("windmark_public.pem"); + #[cfg(feature = "logger")] router.enable_default_logger(true); router.set_error_handler(Box::new(move |_| { error_count += 1; @@ -185,13 +186,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { "/redirect", Box::new(|_| Response::PermanentRedirect("gemini://localhost/test".into())), ); + #[cfg(feature = "auto-deduce-mime")] + router.mount("/auto-file", { + Box::new(|_| Response::SuccessFileAuto(include_bytes!("../LICENSE"))) + }); router.mount("/file", { - #[cfg(feature = "auto-deduce-mime")] - { - Box::new(|_| Response::SuccessFile(include_bytes!("../LICENSE"))) - } - - #[cfg(not(feature = "auto-deduce-mime"))] Box::new(|_| { Response::SuccessFile( include_bytes!("../LICENSE"), |