Skip to content

Commit

Permalink
Merge pull request #1794 from Kobzol/content-type-root
Browse files Browse the repository at this point in the history
Add content type for the root path
  • Loading branch information
Mark-Simulacrum authored Jan 8, 2024
2 parents 5c87745 + 7b28925 commit fea52a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion site/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,11 @@ async fn handle_fs_path(req: &Request, path: &str) -> Option<http::Response<hype
Some("svg") => response = response.header("Content-Type", "image/svg+xml"),
Some("css") => response = response.header("Content-Type", "text/css"),
Some("js") => response = response.header("Content-Type", "application/javascript"),
_ => (),
_ => {
if path.is_empty() || path == "/" {
response = response.header_typed(ContentType::html());
}
}
}

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

0 comments on commit fea52a6

Please sign in to comment.