diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2017-11-16 21:28:11 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2017-11-16 21:28:11 +0100 |
commit | f09e8e56921361b406e40eddd6ded9daca9dc8a5 (patch) | |
tree | 1539112896c9b1c78308fa89c308bbc413df01d6 | |
parent | 44c10f9710632a72427120ccdb9f16ad146574b4 (diff) | |
download | rocket-blog-f09e8e56921361b406e40eddd6ded9daca9dc8a5.tar.gz rocket-blog-f09e8e56921361b406e40eddd6ded9daca9dc8a5.tar.bz2 rocket-blog-f09e8e56921361b406e40eddd6ded9daca9dc8a5.zip |
Set correct content-type for response.
-rw-r--r-- | src/main.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 55131fc..e0501d0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,6 +8,7 @@ extern crate rocket_blog; use self::diesel::prelude::*; use self::rocket_blog::{schema, models}; +use rocket::response; #[derive(BartDisplay)] #[template = "templates/index.html"] @@ -17,14 +18,14 @@ struct IndexTemplate<'a> { } #[get("/")] -fn index(conn: rocket_blog::DbConn) -> String { +fn index(conn: rocket_blog::DbConn) -> content::Html<String> { use schema::posts::dsl::*; let results = posts.filter(published.eq(false)) .limit(5) .load::<models::Post>(&*conn) .expect("Error loading posts"); - format!("{}", &IndexTemplate{ title: "Bloggen", posts: results }) + content::Html(format!("{}", &IndexTemplate{ title: "Bloggen", posts: results })) } fn main() { |