Skip to content

Commit 943aa99

Browse files
monktasticmattwhisenhunt
authored andcommitted
NetHttpRequest should only set Content-Length if it's not set.
See #346.
1 parent 86bc0ae commit 943aa99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

google-http-client/src/main/java/com/google/api/client/http/javanet/NetHttpRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public LowLevelHttpResponse execute() throws IOException {
6363
}
6464
long contentLength = getContentLength();
6565
if (contentLength >= 0) {
66-
addHeader("Content-Length", Long.toString(contentLength));
66+
connection.setRequestProperty("Content-Length", Long.toString(contentLength));
6767
}
6868
String requestMethod = connection.getRequestMethod();
6969
if ("POST".equals(requestMethod) || "PUT".equals(requestMethod)) {

0 commit comments

Comments
 (0)