Skip to content

Commit

Permalink
Fixes #462
Browse files Browse the repository at this point in the history
  • Loading branch information
maximdim authored and adriancole committed Nov 8, 2016
1 parent 9a859da commit ea1ae43
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/main/java/feign/Logger.java
Expand Up @@ -79,7 +79,8 @@ protected Response logAndRebufferResponse(String configKey, Level logLevel, Resp
long elapsedTime) throws IOException {
String reason = response.reason() != null && logLevel.compareTo(Level.NONE) > 0 ?
" " + response.reason() : "";
log(configKey, "<--- HTTP/1.1 %s%s (%sms)", response.status(), reason, elapsedTime);
int status = response.status();
log(configKey, "<--- HTTP/1.1 %s%s (%sms)", status, reason, elapsedTime);
if (logLevel.ordinal() >= Level.HEADERS.ordinal()) {

for (String field : response.headers().keySet()) {
Expand All @@ -89,7 +90,9 @@ protected Response logAndRebufferResponse(String configKey, Level logLevel, Resp
}

int bodyLength = 0;
if (response.body() != null) {
if (response.body() != null && !(status == 204 || status == 205)) {
// HTTP 204 No Content "...response MUST NOT include a message-body"
// HTTP 205 Reset Content "...response MUST NOT include an entity"
if (logLevel.ordinal() >= Level.FULL.ordinal()) {
log(configKey, ""); // CRLF
}
Expand Down

0 comments on commit ea1ae43

Please sign in to comment.