Skip to content

Commit

Permalink
extended condition not to add the content-length header negative (#4967)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjezek authored Jan 18, 2022
1 parent e84b5e8 commit 4106350
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -509,7 +509,7 @@ public ClientResponse apply(final ClientRequest clientRequest) throws Processing
final HttpEntity entity = response.getEntity();

if (entity != null) {
if (headers.get(HttpHeaders.CONTENT_LENGTH) == null) {
if (headers.get(HttpHeaders.CONTENT_LENGTH) == null && entity.getContentLength() >= 0) {
headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(entity.getContentLength()));
}

Expand Down

0 comments on commit 4106350

Please sign in to comment.