diff options
| author | Fuwn <[email protected]> | 2022-03-31 03:02:09 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-03-31 03:02:09 +0000 |
| commit | 00f1d10de4f6597f22fec086c34265b322dd9ef3 (patch) | |
| tree | ed12a2f9c6dec57193ea38124ce00b3cf36459b0 /examples | |
| parent | fix(router): use different certificate file (diff) | |
| download | windmark-00f1d10de4f6597f22fec086c34265b322dd9ef3.tar.xz windmark-00f1d10de4f6597f22fec086c34265b322dd9ef3.zip | |
feat(features): auto-deduce-mime
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/windmark.rs | 18 |
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 } |