Simplify HttpHeaders constructor
As of gh-33913, `HttpHeaders` does not implement the `MultiValueMap` contract anymore, so we can take this opportunity to simplify one of the constructors to not consider that the argument could be an `HttpHeaders` instance. This case is already covered by the other constructor. See gh-33913
This commit is contained in:
parent
2a846c9594
commit
e8f71ab5ef
|
|
@ -455,18 +455,7 @@ public class HttpHeaders implements Serializable {
|
|||
*/
|
||||
public HttpHeaders(MultiValueMap<String, String> headers) {
|
||||
Assert.notNull(headers, "MultiValueMap must not be null");
|
||||
if (headers == EMPTY) {
|
||||
this.headers = CollectionUtils.toMultiValueMap(new LinkedCaseInsensitiveMap<>(8, Locale.ENGLISH));
|
||||
}
|
||||
else if (headers instanceof HttpHeaders httpHeaders) {
|
||||
while (httpHeaders.headers instanceof HttpHeaders wrapped) {
|
||||
httpHeaders = wrapped;
|
||||
}
|
||||
this.headers = httpHeaders.headers;
|
||||
}
|
||||
else {
|
||||
this.headers = headers;
|
||||
}
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue