diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 436035029..a79cba14b 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -813,7 +813,7 @@ fn detect_mime(file_path: impl AsRef) -> &'static str { Some("markdown") => "text/markdown", Some("css") => "text/css", Some("toml") => "text/toml", - Some("js") => "application/javascript", + Some("js") => "text/javascript", Some("json") => "application/json", _ => mime, } @@ -852,7 +852,7 @@ mod test { check_mime(".gitignore", "text/plain"); check_mime("hello.toml", "text/toml"); check_mime("hello.css", "text/css"); - check_mime("hello.js", "application/javascript"); + check_mime("hello.js", "text/javascript"); check_mime("hello.html", "text/html"); check_mime("hello.hello.md", "text/markdown"); check_mime("hello.markdown", "text/markdown"); diff --git a/src/web/statics.rs b/src/web/statics.rs index b09d4263c..1ffc7956b 100644 --- a/src/web/statics.rs +++ b/src/web/statics.rs @@ -158,7 +158,7 @@ mod tests { assert_cache_control(&resp, CachePolicy::ForeverInCdnAndBrowser, &env.config()); assert_eq!( resp.headers().get("Content-Type"), - Some(&"application/javascript".parse().unwrap()), + Some(&"text/javascript".parse().unwrap()), ); assert!(resp.content_length().unwrap() > 10); assert!(resp.text()?.contains(expected_content));