diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/samples/web/WebSpringJupiterTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/samples/web/WebSpringJupiterTests.java index 0db7179131..746dbdbaa1 100644 --- a/spring-test/src/test/java/org/springframework/test/context/aot/samples/web/WebSpringJupiterTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/aot/samples/web/WebSpringJupiterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ public class WebSpringJupiterTests { void resources() throws Exception { this.mockMvc.perform(get("/resources/Spring.js")) .andExpectAll( - content().contentType("application/javascript"), + content().contentType("text/javascript"), content().string(containsString("Spring={};")) ); } diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/WebAppResourceTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/WebAppResourceTests.java index f40370290e..a4b60648b2 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/WebAppResourceTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/context/WebAppResourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ public class WebAppResourceTests { testClient.get().uri("/resources/Spring.js") .exchange() .expectStatus().isOk() - .expectHeader().contentType("application/javascript") + .expectHeader().contentType("text/javascript") .expectBody(String.class).value(containsString("Spring={};")); } diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java index 80638e94b9..c12826aeb1 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/context/WebAppResourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ public class WebAppResourceTests { @Test public void resourceRequest() throws Exception { this.mockMvc.perform(get("/resources/Spring.js")) - .andExpect(content().contentType("application/javascript")) + .andExpect(content().contentType("text/javascript")) .andExpect(content().string(containsString("Spring={};"))); } diff --git a/spring-web/src/main/resources/org/springframework/http/mime.types b/spring-web/src/main/resources/org/springframework/http/mime.types index 597425c118..c89912b67a 100644 --- a/spring-web/src/main/resources/org/springframework/http/mime.types +++ b/spring-web/src/main/resources/org/springframework/http/mime.types @@ -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 diff --git a/spring-web/src/test/java/org/springframework/http/MediaTypeFactoryTests.java b/spring-web/src/test/java/org/springframework/http/MediaTypeFactoryTests.java index ce825c3af4..35eda2b5c9 100644 --- a/spring-web/src/test/java/org/springframework/http/MediaTypeFactoryTests.java +++ b/spring-web/src/test/java/org/springframework/http/MediaTypeFactoryTests.java @@ -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(); } diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java index 9915b3f660..419996d40c 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java @@ -606,7 +606,7 @@ class ResourceWebHandlerTests { setBestMachingPattern(exchange, "/**"); this.handler.handle(exchange).block(TIMEOUT); - assertThat(exchange.getResponse().getHeaders().getContentType()).isEqualTo(MediaType.parseMediaType("application/javascript")); + assertThat(exchange.getResponse().getHeaders().getContentType()).isEqualTo(MediaType.parseMediaType("text/javascript")); assertResponseBody(exchange, "function foo() { console.log(\"hello world\"); }"); } @@ -619,12 +619,11 @@ class ResourceWebHandlerTests { this.handler.handle(exchange).block(TIMEOUT); HttpHeaders headers = exchange.getResponse().getHeaders(); - assertThat(headers.getContentType()).isEqualTo(MediaType.parseMediaType("application/javascript")); + assertThat(headers.getContentType()).isEqualTo(MediaType.parseMediaType("text/javascript")); assertResponseBody(exchange, "function foo() { console.log(\"hello world\"); }"); } - @Test - // gh-27538, gh-27624 + @Test // gh-27538, gh-27624 void filterNonExistingLocations() throws Exception { this.handler.afterPropertiesSet(); ResourceWebHandler handler = new ResourceWebHandler();