diff options
author | René Kijewski <kijewski@library.vetmed.fu-berlin.de> | 2022-01-06 14:30:46 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2022-01-07 13:18:03 +0100 |
commit | 332d741f212eb2aac7bfb2eec1df1f33bfb46a05 (patch) | |
tree | f7f2d529d3db59beae9e28db8c3938e37d6a8f20 /askama_rocket/src/lib.rs | |
parent | a9aebf82fbb59a0323c78c4c248eaaafab1ab00f (diff) | |
download | askama-332d741f212eb2aac7bfb2eec1df1f33bfb46a05.tar.gz askama-332d741f212eb2aac7bfb2eec1df1f33bfb46a05.tar.bz2 askama-332d741f212eb2aac7bfb2eec1df1f33bfb46a05.zip |
Use Template::MIME_TYPE instead of extension
Diffstat (limited to '')
-rw-r--r-- | askama_rocket/src/lib.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/askama_rocket/src/lib.rs b/askama_rocket/src/lib.rs index 33bd779..f10ba87 100644 --- a/askama_rocket/src/lib.rs +++ b/askama_rocket/src/lib.rs @@ -5,16 +5,15 @@ use std::io::Cursor; pub use askama::*; -use rocket::http::{ContentType, Status}; +use rocket::http::{Header, Status}; pub use rocket::request::Request; use rocket::response::Response; pub use rocket::response::{Responder, Result}; -pub fn respond<T: Template>(t: &T, ext: &str) -> Result<'static> { +pub fn respond<T: Template>(t: &T, _ext: &str) -> Result<'static> { let rsp = t.render().map_err(|_| Status::InternalServerError)?; - let ctype = ContentType::from_extension(ext).ok_or(Status::InternalServerError)?; Response::build() - .header(ctype) + .header(Header::new("content-type", T::MIME_TYPE)) .sized_body(Cursor::new(rsp)) .ok() } |