aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/routes.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/routes.rs b/src/routes.rs
index b54e565..fed3067 100644
--- a/src/routes.rs
+++ b/src/routes.rs
@@ -27,7 +27,12 @@ pub async fn routes(
let files_dir = Path::new(&files_dir);
match (request.method(), path) {
- (&Method::GET, [""]) => Ok(response(StatusCode::OK, templates::INDEX.to_string())),
+ (&Method::GET, [""]) => {
+ Ok(with_headers(
+ response(StatusCode::OK, templates::INDEX.to_string()),
+ vec![(CONTENT_TYPE, "text/html")],
+ ))
+ },
(&Method::GET, ["static", "main.js"]) => Ok(static_file(
include_str!("static/main.js").to_string(),
"application/javascript",
@@ -126,7 +131,10 @@ async fn get(
let file = db::get_file(&db_conn, file_id.to_string()).await;
match (get_file, file) {
(GetFile::ShowPage, Ok(Some(file))) => {
- Ok(response(StatusCode::OK, templates::file_page(file)))
+ Ok(with_headers(
+ response(StatusCode::OK, templates::file_page(file)),
+ vec![(CONTENT_TYPE, "text/html")],
+ ))
}
(GetFile::Download, Ok(Some(file))) => {
let path = files_dir.join(file_id);