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:
+13
@@ -82,6 +82,19 @@ class HeadersAdaptersTests {
|
||||
.hasSize(0);
|
||||
}
|
||||
|
||||
@ParameterizedHeadersTest
|
||||
void shouldReturnNullWhenRemoveUnknown(MultiValueMap<String, String> headers) {
|
||||
assertThat(headers.remove("unknown")).isEqualTo(null);
|
||||
}
|
||||
|
||||
@ParameterizedHeadersTest
|
||||
void shouldReturnPreviousValuesWhenRemove(MultiValueMap<String, String> headers) {
|
||||
headers.add("TestHeader", "first");
|
||||
headers.add("TestHEADER", "second");
|
||||
|
||||
assertThat(headers.remove("testheader")).hasSize(2);
|
||||
}
|
||||
|
||||
@ParameterizedPopulatedHeadersTest
|
||||
void toString(MultiValueMap<String, String> headers) {
|
||||
String expectedFirstHeader = "TestHeader:\"first\", \"second\", \"third\"";
|
||||
|
||||
Reference in New Issue
Block a user