Change MIME mapping for .js from application/javascript to text/javascript

This application/javascript MIME type is deprecated.

This commit therefore changes the MIME type mapping for *.js files from
application/javascript to text/javascript in order to align with
industry standards.

Closes gh-33197
This commit is contained in:
Sam Brannen
2024-07-12 18:15:18 +02:00
parent 59b9404956
commit 3e48498663
6 changed files with 12 additions and 13 deletions

View File

@@ -146,7 +146,7 @@ application/ipfix ipfix
application/java-archive jar
application/java-serialized-object ser
application/java-vm class
application/javascript js
# application/javascript js
# application/jose
# application/jose+json
# application/jrd+json
@@ -1686,7 +1686,7 @@ text/csv csv
# text/fwdred
# text/grammar-ref-list
text/html html htm
# text/javascript
text/javascript js
# text/jcr-cnd
# text/markdown
# text/mizar

View File

@@ -30,7 +30,7 @@ class MediaTypeFactoryTests {
@Test
void getMediaType() {
assertThat(MediaTypeFactory.getMediaType("file.xml")).contains(MediaType.APPLICATION_XML);
assertThat(MediaTypeFactory.getMediaType("file.js")).contains(MediaType.parseMediaType("application/javascript"));
assertThat(MediaTypeFactory.getMediaType("file.js")).contains(MediaType.parseMediaType("text/javascript"));
assertThat(MediaTypeFactory.getMediaType("file.css")).contains(MediaType.parseMediaType("text/css"));
assertThat(MediaTypeFactory.getMediaType("file.foobar")).isNotPresent();
}