Merge branch '2.5.x' into 2.6.x

Closes gh-30387
pull/30562/head
Andy Wilkinson 3 years ago
commit c739831087

@ -1985,6 +1985,25 @@
"name": "spring.thymeleaf.prefix", "name": "spring.thymeleaf.prefix",
"defaultValue": "classpath:/templates/" "defaultValue": "classpath:/templates/"
}, },
{
"name": "spring.thymeleaf.reactive.media-types",
"defaultValue": [
"text/html",
"application/xhtml+xml",
"application/xml",
"text/xml",
"application/rss+xml",
"application/atom+xml",
"application/javascript",
"application/ecmascript",
"text/javascript",
"text/ecmascript",
"application/json",
"text/css",
"text/plain",
"text/event-stream"
]
},
{ {
"name": "spring.thymeleaf.suffix", "name": "spring.thymeleaf.suffix",
"defaultValue": ".html" "defaultValue": ".html"

@ -87,11 +87,24 @@ class ThymeleafReactiveAutoConfigurationTests {
}); });
} }
@Test
void defaultMediaTypes() {
this.contextRunner.run(
(context) -> assertThat(context.getBean(ThymeleafReactiveViewResolver.class).getSupportedMediaTypes())
.containsExactly(MediaType.TEXT_HTML, MediaType.APPLICATION_XHTML_XML,
MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_RSS_XML,
MediaType.APPLICATION_ATOM_XML, new MediaType("application", "javascript"),
new MediaType("application", "ecmascript"), new MediaType("text", "javascript"),
new MediaType("text", "ecmascript"), MediaType.APPLICATION_JSON,
new MediaType("text", "css"), MediaType.TEXT_PLAIN, MediaType.TEXT_EVENT_STREAM)
.satisfies(System.out::println));
}
@Test @Test
void overrideMediaTypes() { void overrideMediaTypes() {
this.contextRunner.withPropertyValues("spring.thymeleaf.reactive.media-types:text/html,text/plain").run( this.contextRunner.withPropertyValues("spring.thymeleaf.reactive.media-types:text/html,text/plain").run(
(context) -> assertThat(context.getBean(ThymeleafReactiveViewResolver.class).getSupportedMediaTypes()) (context) -> assertThat(context.getBean(ThymeleafReactiveViewResolver.class).getSupportedMediaTypes())
.contains(MediaType.TEXT_HTML, MediaType.TEXT_PLAIN)); .containsExactly(MediaType.TEXT_HTML, MediaType.TEXT_PLAIN));
} }
@Test @Test

Loading…
Cancel
Save