mirror of
https://github.com/apache/jclouds.git
synced 2025-02-07 18:49:52 +00:00
HttpUrlConnection reverts Content-Length=0 on POST unless doOutput is set to true
This commit is contained in:
parent
a27d11ddef
commit
778bd6c98f
@ -231,6 +231,11 @@ public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorSe
|
||||
protected void writeNothing(HttpURLConnection connection) {
|
||||
if (!HttpRequest.NON_PAYLOAD_METHODS.contains(connection.getRequestMethod())) {
|
||||
connection.setRequestProperty(CONTENT_LENGTH, "0");
|
||||
// support zero length posts.
|
||||
if ("POST".equals(connection.getRequestMethod())) {
|
||||
connection.setFixedLengthStreamingMode(0);
|
||||
connection.setDoOutput(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user