mirror of https://github.com/apache/kafka.git
				
				
				
			MINOR: Redirect response code in Connect's RestClient to logs instead of stdout
Sending the response code of an http request issued via `RestClient` in Connect to stdout seems like a unconventional choice.
This PR redirects the responds code with a message in the logs at DEBUG level (usually the same level as the one that the caller of `RestClient.httpRequest` uses.
This fix will also fix system tests that broke by outputting this response code to stdout.
Author: Konstantine Karantasis <konstantine@confluent.io>
Reviewers: Randall Hauch <rhauch@gmail.com>, Damian Guy <damian.guy@gmail.com>
Closes #4591 from kkonstantine/MINOR-Redirect-response-code-in-Connect-RestClient-to-logs-instead-of-stdout
(cherry picked from commit b79e11bb51)
Signed-off-by: Damian Guy <damian.guy@gmail.com>
			
			
This commit is contained in:
		
							parent
							
								
									323e555074
								
							
						
					
					
						commit
						d373fe2e37
					
				|  | @ -82,12 +82,14 @@ public class RestClient { | |||
|             req.method(method); | ||||
|             req.accept("application/json"); | ||||
|             req.agent("kafka-connect"); | ||||
|             if (serializedBody != null) { | ||||
|                 req.content(new StringContentProvider(serializedBody, StandardCharsets.UTF_8), "application/json"); | ||||
|             } | ||||
| 
 | ||||
|             ContentResponse res = req.send(); | ||||
| 
 | ||||
|             int responseCode = res.getStatus(); | ||||
|             System.out.println(responseCode); | ||||
|             log.debug("Request's response code: {}", responseCode); | ||||
|             if (responseCode == HttpStatus.NO_CONTENT_204) { | ||||
|                 return new HttpResponse<>(responseCode, convertHttpFieldsToMap(res.getHeaders()), null); | ||||
|             } else if (responseCode >= 400) { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue