-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Javadoc of ServerHttpRequest.Builder
clearly says:
Line 140 in 5190eaf
* Set or override the specified header. |
which is part of the header(String, String)
method (signature can be seen below).
/**
* Set or override the specified header.
*/
Builder header(String key, String value);
but the default implementation (DefaultServerHttpRequestBuilder
) uses an instance of HttpHeaders
, which internally uses a MultiValueMap<String, String>
to store headers. So, calling the said method does not override the header, but adds it in the MultiValueMap
.
Check the following links:
Line 48 in 5190eaf
private HttpHeaders httpHeaders; |
Line 115 in 5190eaf
this.httpHeaders.add(key, value); |
spring-framework/spring-web/src/main/java/org/springframework/http/HttpHeaders.java
Line 417 in 5190eaf
final MultiValueMap<String, String> headers; |
spring-framework/spring-web/src/main/java/org/springframework/http/HttpHeaders.java
Line 1622 in 5190eaf
this.headers.add(headerName, headerValue); |