On Tue, 17 Nov 2020 17:28:45 GMT, Daniel Fuchs <[email protected]> wrote:
>> src/java.net.http/share/classes/java/net/http/HttpRequest.java line 335:
>>
>>> 333: * <li> Remove a particular header (e.g. Foo-Bar):
>>> 334: * <pre>{@code HttpRequest.newBuilder(request, (name, value) ->
>>> name.equalsIgnoreCase("Foo-Bar"))}</pre>
>>> 335: * </ul>
>>
>> Does the example above not result in "Foo-Bar" being the only header being
>> copied across? So, maybe it should say "Retain a particular header"
>
> Ah! Good catch - I believe the code is buggy. It should have been
> `!name.equalsIgnoreCase(...)`.
Patrick - can you add a test case with exactly **that** use case? I know you
have similar tests which remove `"testName1"`, but it would be good to have a
test that verifies that **the exact code** shown in the `@apiNote` works as
expected. Your tests should have caught that mistake.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1059