From 00f1d10de4f6597f22fec086c34265b322dd9ef3 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 31 Mar 2022 03:02:09 +0000 Subject: feat(features): auto-deduce-mime --- examples/windmark.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/windmark.rs b/examples/windmark.rs index 93eccce..211d235 100644 --- a/examples/windmark.rs +++ b/examples/windmark.rs @@ -155,10 +155,20 @@ async fn main() -> Result<(), Box> { Response::PermanentRedirect("gemini://localhost/test".into()) }), ) - .mount( - "/file", - Box::new(|_| Response::SuccessFile(include_bytes!("../LICENSE"))), - ) + .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"), + "text/plain".to_string(), + ) + }) + }) .run() .await } -- cgit v1.2.3