Merge branch '6.1.x'
This commit is contained in:
commit
9df4fcdc9e
|
@ -436,8 +436,11 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
|||
if (headers == EMPTY) {
|
||||
this.headers = CollectionUtils.toMultiValueMap(new LinkedCaseInsensitiveMap<>(8, Locale.ENGLISH));
|
||||
}
|
||||
else if (headers instanceof ReadOnlyHttpHeaders readOnlyHttpHeaders) {
|
||||
this.headers = readOnlyHttpHeaders.headers;
|
||||
else if (headers instanceof HttpHeaders httpHeaders) {
|
||||
while (httpHeaders.headers instanceof HttpHeaders wrapped) {
|
||||
httpHeaders = wrapped;
|
||||
}
|
||||
this.headers = httpHeaders.headers;
|
||||
}
|
||||
else {
|
||||
this.headers = headers;
|
||||
|
|
|
@ -69,6 +69,14 @@ class HttpHeadersTests {
|
|||
assertThat(writable.getContentType()).isEqualTo(MediaType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test
|
||||
void writableHttpHeadersUnwrapsMultiple() {
|
||||
HttpHeaders originalExchangeHeaders = HttpHeaders.readOnlyHttpHeaders(new HttpHeaders());
|
||||
HttpHeaders firewallHeaders = new HttpHeaders(originalExchangeHeaders);
|
||||
HttpHeaders writeable = new HttpHeaders(firewallHeaders);
|
||||
writeable.setContentType(MediaType.APPLICATION_JSON);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOrEmpty() {
|
||||
String key = "FOO";
|
||||
|
|
Loading…
Reference in New Issue