On Tue, 29 Mar 2022 18:23:02 GMT, Daniel Jeliński <[email protected]> wrote:
>> **Issue**
>> When using the `HttpClient.send()` to send a GET request created using the
>> `HttpRequest.newBuilder()`, a `Content-length: 0` header is set. This
>> behaviour causes issues with many services as a body related header is
>> usually not expected to be included with a GET request.
>>
>> **Solution**
>> `Http1Request.java` was modified so that when the request method is a GET, a
>> `Content-length` header is not added to the request. However, if a developer
>> chooses to include a body in a GET request (though it is generally
>> considered bad practice), a `Content-length` header with the appropriate
>> value will be added.
>
> src/java.net.http/share/classes/jdk/internal/net/http/Http1Request.java line
> 305:
>
>> 303: if (contentLength == 0) {
>> 304: systemHeadersBuilder.setHeader("Content-Length", "0");
>> 305: System.err.println("in 1");
>
> did you forget to remove this?
I did indeed, silly mistake on my part!
-------------
PR: https://git.openjdk.java.net/jdk/pull/8017