aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama_shared/src/generator.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs
index e4eb9ec..173ecbf 100644
--- a/askama_shared/src/generator.rs
+++ b/askama_shared/src/generator.rs
@@ -251,6 +251,15 @@ impl<'a> Generator<'a> {
self.write_header(state, "::askama::iron::Modifier<::askama::iron::Response>", &[]);
self.writeln("fn modify(self, res: &mut ::askama::iron::Response) {");
self.writeln("res.body = Some(Box::new(self.render().unwrap().into_bytes()));");
+
+ let ext = state.input.path.extension().map_or("", |s| s.to_str().unwrap_or(""));
+ match ext {
+ "html" | "htm" => {
+ self.writeln("::askama::iron::ContentType::html().0.modify(res);");
+ },
+ _ => (),
+ };
+
self.writeln("}");
self.writeln("}");
}