Fix "remove" implementation in netty headers adapter

Prior to this commit, the `Netty4HeadersAdapter` `MultiValueMapi#remove`
implementation would return an empty list if no value was present. This
is not consistent with other implementations.

This change ensures that `null` is returned for those cases.

Fixes gh-36226
This commit is contained in:
Brian Clozel
2026-01-29 11:06:46 +01:00
parent 16f4b23c32
commit e1d3076570
2 changed files with 14 additions and 1 deletions
@@ -140,7 +140,7 @@ public final class Netty4HeadersAdapter implements MultiValueMap<String, String>
@Override
public @Nullable List<String> remove(Object key) {
if (key instanceof String headerName) {
if (key instanceof String headerName && this.headers.contains(headerName)) {
List<String> previousValues = this.headers.getAll(headerName);
this.headers.remove(headerName);
return previousValues;