Modify return on post /loggers to HTTP 204

This commit alter the return http status code from 200 to 204.

Closes gh-8919
This commit is contained in:
Eddú Meléndez 2017-04-18 00:44:42 -05:00 committed by Stephane Nicoll
parent 2ccefbc275
commit ce0b1b242b
3 changed files with 4 additions and 4 deletions

View File

@ -126,7 +126,7 @@ public class EndpointDocumentation {
.perform(post("/application/loggers/org.springframework.boot")
.contentType(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON)
.content("{\"configuredLevel\": \"DEBUG\"}"))
.andExpect(status().isOk()).andDo(document("set-logger"));
.andExpect(status().isNoContent()).andDo(document("set-logger"));
}
@Test

View File

@ -71,7 +71,7 @@ public class LoggersMvcEndpoint extends EndpointMvcAdapter {
try {
LogLevel logLevel = getLogLevel(configuration);
this.delegate.setLogLevel(name, logLevel);
return ResponseEntity.ok().build();
return ResponseEntity.noContent().build();
}
catch (IllegalArgumentException ex) {
return ResponseEntity.badRequest().build();

View File

@ -150,7 +150,7 @@ public class LoggersMvcEndpointTests {
@Test
public void setLoggerUsingApplicationJsonShouldSetLogLevel() throws Exception {
this.mvc.perform(post(PATH + "/ROOT").contentType(MediaType.APPLICATION_JSON)
.content("{\"configuredLevel\":\"debug\"}")).andExpect(status().isOk());
.content("{\"configuredLevel\":\"debug\"}")).andExpect(status().isNoContent());
verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG);
}
@ -158,7 +158,7 @@ public class LoggersMvcEndpointTests {
public void setLoggerUsingActuatorV2JsonShouldSetLogLevel() throws Exception {
this.mvc.perform(post(PATH + "/ROOT")
.contentType(ActuatorMediaTypes.APPLICATION_ACTUATOR_V2_JSON)
.content("{\"configuredLevel\":\"debug\"}")).andExpect(status().isOk());
.content("{\"configuredLevel\":\"debug\"}")).andExpect(status().isNoContent());
verify(this.loggingSystem).setLogLevel("ROOT", LogLevel.DEBUG);
}