Copy header values instead of header lists in DefaultClientRequestBuilder
This commit changes the `headers(HttpHeaders)` method in DefaultClientRequestBuilder so that it copies the individual header values instead of using the `List<String>` value directly. The reason for this change is that the list of values can be immutable, and adding additional values after that could result in UnsupportedOperationExceptions.
This commit is contained in:
parent
a0bce618c2
commit
510436bae9
|
@ -73,7 +73,12 @@ class DefaultClientRequestBuilder implements ClientRequest.Builder {
|
|||
|
||||
@Override
|
||||
public ClientRequest.Builder headers(HttpHeaders headers) {
|
||||
this.headers.putAll(headers);
|
||||
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
|
||||
String headerName = entry.getKey();
|
||||
for (String headerValue : entry.getValue()) {
|
||||
this.headers.add(headerName, headerValue);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue