Skip to content

Commit 86c6e44

Browse files
committed
forgot that multivalue headers are basically csvs
1 parent 35ff831 commit 86c6e44

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

http-client/src/main/java/io/avaje/http/client/DHttpClientRequest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.*;
1717
import java.util.concurrent.CompletableFuture;
1818
import java.util.function.Supplier;
19+
import java.util.stream.Collectors;
1920
import java.util.stream.Stream;
2021

2122
import static java.net.http.HttpResponse.BodyHandlers.discarding;
@@ -124,13 +125,11 @@ public HttpClientRequest header(String name, String value) {
124125
}
125126

126127
@Override
128+
@SuppressWarnings("unchecked")
127129
public HttpClientRequest header(String name, Object value) {
128130

129131
if (value instanceof Collection) {
130-
for (final var e : (Collection) value) {
131-
header(name, e);
132-
}
133-
return this;
132+
value = ((Collection) value).stream().map(Object::toString).collect(Collectors.joining(","));
134133
}
135134

136135
return value != null ? header(name, value.toString()) : this;

0 commit comments

Comments
 (0)