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:
Eddú Meléndez
2017-04-04 12:31:08 -05:00
committed by Stephane Nicoll
parent 934d33685a
commit cf08162148
2 changed files with 18 additions and 4 deletions

View File

@@ -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,