Skip to content

Commit

Permalink
Merge branch '6.1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
bclozel committed Oct 25, 2024
2 parents d1d6ff8 + a06bbcc commit 9df4fcd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,11 @@ public HttpHeaders(MultiValueMap<String, String> headers) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ void constructorUnwrapsReadonly() {
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";
Expand Down

0 comments on commit 9df4fcd

Please sign in to comment.