RFR: 8327796: Add method to java.net.http.HttpRequest to return a GET request in one call [v2]
Daniel Fuchs
dfuchs at openjdk.org
Wed Mar 13 11:31:13 UTC 2024
On Tue, 12 Mar 2024 21:42:57 GMT, Michael McMahon <michaelm at openjdk.org> wrote:
>> I wonder if it should be a `Predicate<HttpResponse>` instead?
>
> No, we added `HttpResponse.ResponseInfo` for this kind of purpose. It's an immutable subset of HttpResponse state (notably excluding the body itself which is potentially mutable). Also it would be strange to make the body available to a predicate that is deciding whether to provide access to the body.
OK - I see the point about the body. I was asking because `HttpResponse` has some additional info like request, previous request, and SSL session. On the other hand all what you need to make a decision here is probably status code and response headers which `ResponseInfo` provides.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18227#discussion_r1523052457
More information about the net-dev
mailing list