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:
		
							parent
							
								
									2ccefbc275
								
							
						
					
					
						commit
						ce0b1b242b
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue