Skip to content

Commit 007dea6

Browse files
committed
revert client changes
1 parent a4f04f2 commit 007dea6

File tree

4 files changed

+2
-70
lines changed

4 files changed

+2
-70
lines changed

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

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

2221
import static java.net.http.HttpResponse.BodyHandlers.discarding;
@@ -125,25 +124,7 @@ public HttpClientRequest header(String name, String value) {
125124
}
126125

127126
@Override
128-
public HttpClientRequest header(String name, Collection<String> value) {
129-
if (headers == null) {
130-
headers = new LinkedHashMap<>();
131-
}
132-
headers.computeIfAbsent(name, s -> new ArrayList<>()).addAll(value);
133-
return this;
134-
}
135-
136-
@Override
137-
@SuppressWarnings("unchecked")
138127
public HttpClientRequest header(String name, Object value) {
139-
140-
if (value instanceof Collection) {
141-
final var headerList =
142-
((Collection<Object>) value).stream().map(Object::toString).collect(Collectors.toList());
143-
144-
return header(name, headerList);
145-
}
146-
147128
return value != null ? header(name, value.toString()) : this;
148129
}
149130

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.net.http.HttpResponse;
66
import java.nio.file.Path;
77
import java.time.Duration;
8-
import java.util.Collection;
98
import java.util.List;
109
import java.util.Map;
1110
import java.util.function.Supplier;
@@ -127,15 +126,6 @@ public interface HttpClientRequest {
127126
*/
128127
HttpClientRequest header(Map<String, ?> headers);
129128

130-
/**
131-
* Add the headers to the request via Collection.
132-
*
133-
* @param name The header name
134-
* @param value The header values
135-
* @return The request being built
136-
*/
137-
HttpClientRequest header(String name, Collection<String> value);
138-
139129
/**
140130
* Return the header values that have been set for the given header name.
141131
*

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.net.URLEncoder;
44
import java.nio.charset.StandardCharsets;
5-
import java.util.Collection;
65
import java.util.Map;
76

87
/**
@@ -85,14 +84,6 @@ public UrlBuilder queryParam(String name, String value) {
8584
* The name and value parameters are url encoded.
8685
*/
8786
public UrlBuilder queryParam(String name, Object value) {
88-
89-
if (value instanceof Collection) {
90-
for (var e : (Collection) value) {
91-
queryParam(name, e);
92-
}
93-
return this;
94-
}
95-
9687
if (value != null) {
9788
addQueryParam(name, value.toString());
9889
}

http-client/src/test/java/io/avaje/http/client/DHttpClientRequestTest.java

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package io.avaje.http.client;
22

3-
import static org.assertj.core.api.Assertions.assertThat;
3+
import org.junit.jupiter.api.Test;
44

55
import java.time.Duration;
6-
import java.util.List;
76

8-
import org.junit.jupiter.api.Test;
7+
import static org.assertj.core.api.Assertions.assertThat;
98

109
class DHttpClientRequestTest {
1110

@@ -22,35 +21,6 @@ void suppressLogging_listenerEvent_expect_suppressedPayloadContent() {
2221
assertThat(event.responseBody()).isEqualTo("<suppressed response body>");
2322
}
2423

25-
@Test
26-
void assertHeader() {
27-
final var request = new DHttpClientRequest(context, Duration.ZERO);
28-
29-
final var headers =
30-
request
31-
.header("Accept", (Object) List.of("application/json", "application/json2"))
32-
.header("Accept");
33-
34-
assertThat(headers).asList().contains("application/json", "application/json2");
35-
}
36-
37-
@Test
38-
void assertQuery() {
39-
final var client = HttpClient.builder().baseUrl("https://ap7i.github.com").build();
40-
41-
final var uri =
42-
client
43-
.request()
44-
.queryParam("param", List.of("param1", "param2"))
45-
.HEAD()
46-
.asDiscarding()
47-
.request()
48-
.uri()
49-
.toString();
50-
51-
assertThat(uri).isEqualTo("https://ap7i.github.com?param=param1&param=param2");
52-
}
53-
5424
@Test
5525
void skipAuthToken_listenerEvent_expect_suppressedPayloadContent() {
5626
final DHttpClientRequest request = new DHttpClientRequest(context, Duration.ZERO);

0 commit comments

Comments
 (0)