Created
January 18, 2021 04:44
-
-
Save vrnsky/a94514044c1772238017ea526bcb8320 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void logResponse(ContentCachingResponseWrapper response, String prefix) { | |
int status = response.getStatus(); | |
logger.info("{} {} {}", prefix, status, HttpStatus.valueOf(status).getReasonPhrase()); | |
response.getHeaderNames().forEach(header -> response.getHeaders(header).forEach(headerValue -> logger.info("{} {} {}", prefix, header, headerValue))); | |
logger.info("{}", prefix); | |
byte[] content = response.getContentAsByteArray(); | |
if (content.length > 0) { | |
logContent(content, response.getContentType(), response.getCharacterEncoding(), prefix); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment