aboutsummaryrefslogtreecommitdiffstats
path: root/askama_tide
diff options
context:
space:
mode:
authorLibravatar René Kijewski <kijewski@library.vetmed.fu-berlin.de>2022-01-06 14:30:46 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2022-01-07 13:18:03 +0100
commit332d741f212eb2aac7bfb2eec1df1f33bfb46a05 (patch)
treef7f2d529d3db59beae9e28db8c3938e37d6a8f20 /askama_tide
parenta9aebf82fbb59a0323c78c4c248eaaafab1ab00f (diff)
downloadaskama-332d741f212eb2aac7bfb2eec1df1f33bfb46a05.tar.gz
askama-332d741f212eb2aac7bfb2eec1df1f33bfb46a05.tar.bz2
askama-332d741f212eb2aac7bfb2eec1df1f33bfb46a05.zip
Use Template::MIME_TYPE instead of extension
Diffstat (limited to 'askama_tide')
-rw-r--r--askama_tide/src/lib.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/askama_tide/src/lib.rs b/askama_tide/src/lib.rs
index 2854cb6..be597bb 100644
--- a/askama_tide/src/lib.rs
+++ b/askama_tide/src/lib.rs
@@ -6,16 +6,12 @@ pub use askama;
pub use tide;
use askama::*;
-use tide::{http::Mime, Body, Response};
+use tide::{Body, Response};
-pub fn try_into_body<T: Template>(t: &T, ext: &str) -> Result<Body> {
+pub fn try_into_body<T: Template>(t: &T, _ext: &str) -> Result<Body> {
let string = t.render()?;
let mut body = Body::from_string(string);
-
- if let Some(mime) = Mime::from_extension(ext) {
- body.set_mime(mime);
- }
-
+ body.set_mime(T::MIME_TYPE);
Ok(body)
}