From 332d741f212eb2aac7bfb2eec1df1f33bfb46a05 Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Thu, 6 Jan 2022 14:30:46 +0100 Subject: Use Template::MIME_TYPE instead of extension --- askama_tide/src/lib.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'askama_tide/src/lib.rs') 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: &T, ext: &str) -> Result { +pub fn try_into_body(t: &T, _ext: &str) -> Result { 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) } -- cgit