Polish HttpRequestValues

Signed-off-by: Johnny Lim <izeye@naver.com>
This commit is contained in:
Johnny Lim 2025-05-17 18:18:28 +09:00 committed by Rossen Stoyanchev
parent 3290592f58
commit ec49435a4d
1 changed files with 6 additions and 3 deletions

View File

@ -348,8 +348,9 @@ public class HttpRequestValues {
* Add the given header name and values. * Add the given header name and values.
*/ */
public Builder addHeader(String headerName, String... headerValues) { public Builder addHeader(String headerName, String... headerValues) {
HttpHeaders headers = initHeaders();
for (String headerValue : headerValues) { for (String headerValue : headerValues) {
initHeaders().add(headerName, headerValue); headers.add(headerName, headerValue);
} }
return this; return this;
} }
@ -373,8 +374,9 @@ public class HttpRequestValues {
* Add the given cookie name and values. * Add the given cookie name and values.
*/ */
public Builder addCookie(String name, String... values) { public Builder addCookie(String name, String... values) {
MultiValueMap<String, String> cookies = initCookies();
for (String value : values) { for (String value : values) {
initCookies().add(name, value); cookies.add(name, value);
} }
return this; return this;
} }
@ -402,8 +404,9 @@ public class HttpRequestValues {
* parameters. * parameters.
*/ */
public Builder addRequestParameter(String name, String... values) { public Builder addRequestParameter(String name, String... values) {
MultiValueMap<String, String> requestParams = initRequestParams();
for (String value : values) { for (String value : values) {
initRequestParams().add(name, value); requestParams.add(name, value);
} }
return this; return this;
} }