Skip to content

Commit 95a84bb

Browse files
committed
Clarify case-insensitive nature of HttpHeaders
Closes gh-22723
1 parent 4c08863 commit 95a84bb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
* <li>{@link #set(String, String)} sets the header value to a single string value</li>
6464
* </ul>
6565
*
66+
* <p>Note that {@code HttpHeaders} generally treats header names in a case-insensitive manner.
67+
*
6668
* @author Arjen Poutsma
6769
* @author Sebastien Deleuze
6870
* @author Brian Clozel
@@ -415,13 +417,17 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
415417

416418
/**
417419
* Construct a new, empty instance of the {@code HttpHeaders} object.
420+
* <p>This is the common constructor, using a case-insensitive map structure.
418421
*/
419422
public HttpHeaders() {
420423
this(CollectionUtils.toMultiValueMap(new LinkedCaseInsensitiveMap<>(8, Locale.ENGLISH)));
421424
}
422425

423426
/**
424427
* Construct a new {@code HttpHeaders} instance backed by an existing map.
428+
* <p>This constructor is available as an optimization for adapting to existing
429+
* headers map structures, primarily for internal use within the framework.
430+
* @param headers the headers map (expected to operate with case-insensitive keys)
425431
* @since 5.1
426432
*/
427433
public HttpHeaders(MultiValueMap<String, String> headers) {

0 commit comments

Comments
 (0)