Skip to content

Commit ec49435

Browse files
izeyerstoyanchev
authored andcommitted
Polish HttpRequestValues
Signed-off-by: Johnny Lim <izeye@naver.com>
1 parent 3290592 commit ec49435

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

spring-web/src/main/java/org/springframework/web/service/invoker/HttpRequestValues.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,9 @@ public Builder setContentType(MediaType contentType) {
348348
* Add the given header name and values.
349349
*/
350350
public Builder addHeader(String headerName, String... headerValues) {
351+
HttpHeaders headers = initHeaders();
351352
for (String headerValue : headerValues) {
352-
initHeaders().add(headerName, headerValue);
353+
headers.add(headerName, headerValue);
353354
}
354355
return this;
355356
}
@@ -373,8 +374,9 @@ private HttpHeaders initHeaders() {
373374
* Add the given cookie name and values.
374375
*/
375376
public Builder addCookie(String name, String... values) {
377+
MultiValueMap<String, String> cookies = initCookies();
376378
for (String value : values) {
377-
initCookies().add(name, value);
379+
cookies.add(name, value);
378380
}
379381
return this;
380382
}
@@ -402,8 +404,9 @@ private MultiValueMap<String, String> initCookies() {
402404
* parameters.
403405
*/
404406
public Builder addRequestParameter(String name, String... values) {
407+
MultiValueMap<String, String> requestParams = initRequestParams();
405408
for (String value : values) {
406-
initRequestParams().add(name, value);
409+
requestParams.add(name, value);
407410
}
408411
return this;
409412
}

0 commit comments

Comments
 (0)