Skip to content

Commit fea52a6

Browse files
Merge pull request #1794 from Kobzol/content-type-root
Add content type for the root path
2 parents 5c87745 + 7b28925 commit fea52a6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

site/src/server.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,11 @@ async fn handle_fs_path(req: &Request, path: &str) -> Option<http::Response<hype
639639
Some("svg") => response = response.header("Content-Type", "image/svg+xml"),
640640
Some("css") => response = response.header("Content-Type", "text/css"),
641641
Some("js") => response = response.header("Content-Type", "application/javascript"),
642-
_ => (),
642+
_ => {
643+
if path.is_empty() || path == "/" {
644+
response = response.header_typed(ContentType::html());
645+
}
646+
}
643647
}
644648

645649
Some(response.body(hyper::Body::from(source)).unwrap())

0 commit comments

Comments
 (0)