HttpHeaders.writeableHttpHeaders should unwrap many times
Prior to this commit, the `HttpHeaders.writeableHttpHeaders` would only consider headers read-only instances that were wrapped once by `HttpHeaders.readOnlyHttpHeaders`. This does not work when other `HttpHeaders` wrappers are involved in the chain. This commit ensures that `writeableHttpHeaders` unwraps all headers instances down to the actual multivalue map and create a new headers instance out of it. Fixes gh-33789
This commit is contained in:
@@ -57,6 +57,14 @@ class HttpHeadersTests {
|
||||
private final HttpHeaders headers = new HttpHeaders();
|
||||
|
||||
|
||||
@Test
|
||||
void writableHttpHeadersUnwrapsMultiple() {
|
||||
HttpHeaders originalExchangeHeaders = HttpHeaders.readOnlyHttpHeaders(new HttpHeaders());
|
||||
HttpHeaders firewallHeaders = new HttpHeaders(originalExchangeHeaders);
|
||||
HttpHeaders writeable = HttpHeaders.writableHttpHeaders(firewallHeaders);
|
||||
writeable.setContentType(MediaType.APPLICATION_JSON);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOrEmpty() {
|
||||
String key = "FOO";
|
||||
|
||||
Reference in New Issue
Block a user