Merge pull request #8919 from eddumelendez:gh-8814

* pr/8919:
  Modify return on post /loggers to HTTP 204
This commit is contained in:
Stephane Nicoll
2017-05-19 09:43:00 +02:00
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);
}