Fix http status code with unknown log level
This commit changes the http status code to 400 when an unknown log level is specified. Closes gh-8798 See gh-8813
This commit is contained in:
committed by
Stephane Nicoll
parent
934d33685a
commit
cf08162148
@@ -64,6 +64,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
*
|
||||
* @author Ben Hale
|
||||
* @author Phillip Webb
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@@ -169,6 +170,14 @@ public class LoggersMvcEndpointTests {
|
||||
verifyZeroInteractions(this.loggingSystem);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setLoggerWithWrongLogLevel() throws Exception {
|
||||
this.mvc.perform(post("/loggers/ROOT").contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"configuredLevel\":\"other\"}"))
|
||||
.andExpect(status().is4xxClientError());
|
||||
verifyZeroInteractions(this.loggingSystem);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import({ JacksonAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class,
|
||||
|
||||
Reference in New Issue
Block a user