Skip to content

Commit

Permalink
Document default value of spring.thymeleaf.reactive.media-types
Browse files Browse the repository at this point in the history
Closes gh-30280
  • Loading branch information
wilkinsona committed Mar 23, 2022
1 parent 8d882fa commit d8cf332
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Expand Up @@ -1766,6 +1766,25 @@
"name": "spring.thymeleaf.prefix",
"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",
"defaultValue": ".html"
Expand Down
Expand Up @@ -87,11 +87,24 @@ void overrideCharacterEncoding() {
});
}

@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
void overrideMediaTypes() {
this.contextRunner.withPropertyValues("spring.thymeleaf.reactive.media-types:text/html,text/plain").run(
(context) -> assertThat(context.getBean(ThymeleafReactiveViewResolver.class).getSupportedMediaTypes())
.contains(MediaType.TEXT_HTML, MediaType.TEXT_PLAIN));
.containsExactly(MediaType.TEXT_HTML, MediaType.TEXT_PLAIN));
}

@Test
Expand Down

0 comments on commit d8cf332

Please sign in to comment.