Separate server properties for message and errors
Prior to this commit, there was a property server.error.include-details that allowed configuration of the message and errors attributes in a server error response. This commit separates the control of the message and errors attributes into two separate properties named server.error.include-message and server.error.include-binding-errors. When the message attribute is excluded from a servlet response, the value is changed from a hard-coded text value to an empty value. Fixes gh-20505
This commit is contained in:
@@ -71,7 +71,8 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro
|
||||
properties.put("spring.resources.chain.cache", "false");
|
||||
properties.put("spring.template.provider.cache", "false");
|
||||
properties.put("spring.mvc.log-resolved-exception", "true");
|
||||
properties.put("server.error.include-details", "ALWAYS");
|
||||
properties.put("server.error.include-binding-errors", "ALWAYS");
|
||||
properties.put("server.error.include-message", "ALWAYS");
|
||||
properties.put("server.error.include-stacktrace", "ALWAYS");
|
||||
properties.put("server.servlet.jsp.init-parameters.development", "true");
|
||||
properties.put("spring.reactor.debug", "true");
|
||||
|
||||
@@ -108,8 +108,8 @@ class DevToolPropertiesIntegrationTests {
|
||||
ConfigurableEnvironment environment = this.context.getEnvironment();
|
||||
String includeStackTrace = environment.getProperty("server.error.include-stacktrace");
|
||||
assertThat(includeStackTrace).isEqualTo(ErrorProperties.IncludeStacktrace.ALWAYS.toString());
|
||||
String includeDetails = environment.getProperty("server.error.include-details");
|
||||
assertThat(includeDetails).isEqualTo(ErrorProperties.IncludeDetails.ALWAYS.toString());
|
||||
String includeMessage = environment.getProperty("server.error.include-message");
|
||||
assertThat(includeMessage).isEqualTo(ErrorProperties.IncludeAttribute.ALWAYS.toString());
|
||||
}
|
||||
|
||||
protected ConfigurableApplicationContext getContext(Supplier<ConfigurableApplicationContext> supplier)
|
||||
|
||||
Reference in New Issue
Block a user