aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-03-31 03:02:09 +0000
committerFuwn <[email protected]>2022-03-31 03:02:09 +0000
commit00f1d10de4f6597f22fec086c34265b322dd9ef3 (patch)
treeed12a2f9c6dec57193ea38124ce00b3cf36459b0 /examples
parentfix(router): use different certificate file (diff)
downloadwindmark-00f1d10de4f6597f22fec086c34265b322dd9ef3.tar.xz
windmark-00f1d10de4f6597f22fec086c34265b322dd9ef3.zip
feat(features): auto-deduce-mime
Diffstat (limited to 'examples')
-rw-r--r--examples/windmark.rs18
1 files changed, 14 insertions, 4 deletions
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<dyn std::error::Error>> {
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
}