Skip to content

Commit e8f71ab

Browse files
committed
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
1 parent 2a846c9 commit e8f71ab

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

spring-web/src/main/java/org/springframework/http/HttpHeaders.java

+1-12
Original file line numberDiff line numberDiff line change
@@ -455,18 +455,7 @@ public HttpHeaders() {
455455
*/
456456
public HttpHeaders(MultiValueMap<String, String> headers) {
457457
Assert.notNull(headers, "MultiValueMap must not be null");
458-
if (headers == EMPTY) {
459-
this.headers = CollectionUtils.toMultiValueMap(new LinkedCaseInsensitiveMap<>(8, Locale.ENGLISH));
460-
}
461-
else if (headers instanceof HttpHeaders httpHeaders) {
462-
while (httpHeaders.headers instanceof HttpHeaders wrapped) {
463-
httpHeaders = wrapped;
464-
}
465-
this.headers = httpHeaders.headers;
466-
}
467-
else {
468-
this.headers = headers;
469-
}
458+
this.headers = headers;
470459
}
471460

472461
/**

0 commit comments

Comments
 (0)