mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-25 00:09:02 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user