RFR: 8327796: Add method to java.net.http.HttpRequest to return a GET request in one call [v5]

Michael McMahon michaelm at openjdk.org
Wed Mar 20 17:25:22 UTC 2024


On Wed, 20 Mar 2024 15:41:24 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Michael McMahon has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update test/jdk/java/net/httpclient/GETTest.java
>>   
>>   Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
>
> src/java.net.http/share/classes/java/net/http/HttpResponse.java line 154:
> 
>> 152:      */
>> 153:     public Optional<T> bodyWhen(Predicate<ResponseInfo> predicate) throws IOException;
>> 154: 
> 
> I believe the method should be specified to close the body if it is closeable and if it is not returned.

I wasn't sure about that, because that effectively means this method can be called once only (in the case of closeable response bodies). But, maybe that is not unreasonable in those cases. I'll change as suggested.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18227#discussion_r1532508165


More information about the net-dev mailing list