On Tue, 21 Jan 2025 10:58:57 GMT, Volkan Yazıcı <d...@openjdk.org> wrote:
>> Adds `limiting()` factory methods to >> `HttpResponse.Body{Handlers,Subscribers}` to handle excessive server input >> in `HttpClient`. I would appreciate your input whether `discardExcess` >> should be kept or dropped. I plan to file a CSR once there is an agreement >> on the PR. > > Volkan Yazıcı has updated the pull request incrementally with two additional > commits since the last revision: > > - Fix `assertThrows` in `HttpResponseLimitingTest` > - Fix `HttpResponseLimitingTest` license header test/jdk/java/net/httpclient/HttpResponseLimitingTest.java line 148: > 146: .timeout(Duration.ofSeconds(5)) > 147: .build(); > 148: var handler = > BodyHandlers.limiting(BodyHandlers.ofByteArray(), capacity); In this test we are effectively only testing wrapping of a `ofByteArray()` `BodyHandler` with a `limiting()` `BodyHandler` and I think that's OK. `BodyHandler.ofInputStream()` is a bit special. Perhaps we should also add a test which verifies that the returned `InputStream` reaches EOF (and the `is.read()` calls complete with -1 eventually) when wrapped with a limiting BodyHandler with insufficient capacity. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23096#discussion_r1923888258