mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Correct handling of disable-html-escaping
See gh-39504
This commit is contained in:
parent
5746886e64
commit
d597a4d56b
@ -93,7 +93,7 @@ public class GsonAutoConfiguration {
|
|||||||
map.from(properties::getFieldNamingPolicy).to(builder::setFieldNamingPolicy);
|
map.from(properties::getFieldNamingPolicy).to(builder::setFieldNamingPolicy);
|
||||||
map.from(properties::getPrettyPrinting).whenTrue().toCall(builder::setPrettyPrinting);
|
map.from(properties::getPrettyPrinting).whenTrue().toCall(builder::setPrettyPrinting);
|
||||||
map.from(properties::getLenient).whenTrue().toCall(builder::setLenient);
|
map.from(properties::getLenient).whenTrue().toCall(builder::setLenient);
|
||||||
map.from(properties::getDisableHtmlEscaping).whenFalse().toCall(builder::disableHtmlEscaping);
|
map.from(properties::getDisableHtmlEscaping).whenTrue().toCall(builder::disableHtmlEscaping);
|
||||||
map.from(properties::getDateFormat).to(builder::setDateFormat);
|
map.from(properties::getDateFormat).to(builder::setDateFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ class GsonAutoConfigurationTests {
|
|||||||
void withDisableHtmlEscapingTrue() {
|
void withDisableHtmlEscapingTrue() {
|
||||||
this.contextRunner.withPropertyValues("spring.gson.disable-html-escaping:true").run((context) -> {
|
this.contextRunner.withPropertyValues("spring.gson.disable-html-escaping:true").run((context) -> {
|
||||||
Gson gson = context.getBean(Gson.class);
|
Gson gson = context.getBean(Gson.class);
|
||||||
assertThat(gson.htmlSafe()).isTrue();
|
assertThat(gson.htmlSafe()).isFalse();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ class GsonAutoConfigurationTests {
|
|||||||
void withDisableHtmlEscapingFalse() {
|
void withDisableHtmlEscapingFalse() {
|
||||||
this.contextRunner.withPropertyValues("spring.gson.disable-html-escaping:false").run((context) -> {
|
this.contextRunner.withPropertyValues("spring.gson.disable-html-escaping:false").run((context) -> {
|
||||||
Gson gson = context.getBean(Gson.class);
|
Gson gson = context.getBean(Gson.class);
|
||||||
assertThat(gson.htmlSafe()).isFalse();
|
assertThat(gson.htmlSafe()).isTrue();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user