Clarify case-insensitive nature of HttpHeaders

Closes gh-22723
This commit is contained in:
Juergen Hoeller
2019-04-02 20:04:00 +02:00
parent 4c08863776
commit 95a84bbad1

View File

@@ -63,6 +63,8 @@ import org.springframework.util.StringUtils;
* <li>{@link #set(String, String)} sets the header value to a single string value</li>
* </ul>
*
* <p>Note that {@code HttpHeaders} generally treats header names in a case-insensitive manner.
*
* @author Arjen Poutsma
* @author Sebastien Deleuze
* @author Brian Clozel
@@ -415,6 +417,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Construct a new, empty instance of the {@code HttpHeaders} object.
* <p>This is the common constructor, using a case-insensitive map structure.
*/
public HttpHeaders() {
this(CollectionUtils.toMultiValueMap(new LinkedCaseInsensitiveMap<>(8, Locale.ENGLISH)));
@@ -422,6 +425,9 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Construct a new {@code HttpHeaders} instance backed by an existing map.
* <p>This constructor is available as an optimization for adapting to existing
* headers map structures, primarily for internal use within the framework.
* @param headers the headers map (expected to operate with case-insensitive keys)
* @since 5.1
*/
public HttpHeaders(MultiValueMap<String, String> headers) {