aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2024-06-08 12:09:01 +0200
committerJoris2024-06-08 12:09:01 +0200
commitc1c24146266a1e35748421c1afba10b24794af26 (patch)
tree36c42e4f0b25c066ea70ef12440aee25add11e6c
parent2ee900eed41aebeb0f6f791f96bacb21779e6ac0 (diff)
Add content type text/html
-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);