RFR: 8283544: HttpClient GET method adds Content-Length: 0 header [v5]

Daniel Fuchs dfuchs at openjdk.java.net
Tue Apr 19 16:49:16 UTC 2022


On Tue, 19 Apr 2022 16:44:35 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> test/jdk/java/net/httpclient/ContentLengthHeaderTest.java line 202:
>> 
>>> 200:             } else {
>>> 201:                 String responseBody = exchange.getRequestMethod() + " request contained an unexpected " +
>>> 202:                         "Content-length header.";
>> 
>> Maybe the message could include the value of `Content-Length` that was received.
>
> Also it's always better to drain the request input stream even if there is no bytes.

You could possibly do that in `handleResponse()`

-------------

PR: https://git.openjdk.java.net/jdk/pull/8017


More information about the net-dev mailing list