Skip to content

Commit 0211d0a

Browse files
authored
Fix duplicate content-type headers being sent for assets (#137)
1 parent d0e6786 commit 0211d0a

File tree

1 file changed

+4
-4
lines changed
  • rust/stackable-cockpitd/src/handlers

1 file changed

+4
-4
lines changed

rust/stackable-cockpitd/src/handlers/ui.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use axum::{
22
extract::Path,
33
http::{header::CONTENT_TYPE, HeaderValue},
4-
response::{AppendHeaders, Html, IntoResponse},
4+
response::{Html, IntoResponse},
55
routing::get,
66
Router,
77
};
@@ -18,14 +18,14 @@ async fn ui() -> Html<&'static str> {
1818
}
1919
async fn asset(Path(name): Path<String>) -> impl IntoResponse {
2020
(
21-
AppendHeaders([(
21+
[(
2222
CONTENT_TYPE,
23-
match name.split_once('.') {
23+
match name.rsplit_once('.') {
2424
Some((_, "js")) => HeaderValue::from_static("text/javascript"),
2525
Some((_, "css")) => HeaderValue::from_static("text/css"),
2626
_ => HeaderValue::from_static("application/octet-stream"),
2727
},
28-
)]),
28+
)],
2929
stackable_cockpit_web::ASSETS[&name],
3030
)
3131
}

0 commit comments

Comments
 (0)