Skip to content

Commit 7464d5e

Browse files
committed
Merge pull request OpenFeign#324 from dsyer/fix/httpclient
Apache HTTP client hates to have the Content-Length set
2 parents 715e72b + 5244db4 commit 7464d5e

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎httpclient/src/main/java/feign/httpclient/ApacheHttpClient.java‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,9 @@ HttpUriRequest toHttpUriRequest(Request request, Request.Options options) throws
118118
hasAcceptHeader = true;
119119
}
120120

121-
if (headerName.equalsIgnoreCase(Util.CONTENT_LENGTH) &&
122-
requestBuilder.getHeaders(headerName) != null) {
123-
//if the 'Content-Length' header is already present, it's been set from HttpEntity, so we
124-
//won't add it again
121+
if (headerName.equalsIgnoreCase(Util.CONTENT_LENGTH)) {
122+
// The 'Content-Length' header is always set by the Apache client and it
123+
// doesn't like us to set it as well.
125124
continue;
126125
}
127126

0 commit comments

Comments
 (0)