Skip to content

Commit 921fffc

Browse files
committed
Remove unused HttpApi
1 parent 758ee83 commit 921fffc

File tree

6 files changed

+22
-31
lines changed

6 files changed

+22
-31
lines changed

client/src/main/java/io/avaje/http/client/DHttpClientContext.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,8 @@ String firstHeader(HttpHeaders headers, String... names) {
135135
}
136136

137137
<T> HttpResponse<T> send(HttpRequest.Builder requestBuilder, HttpResponse.BodyHandler<T> bodyHandler) {
138-
final HttpRequest request = applyFilters(requestBuilder).build();
139138
try {
140-
return httpClient.send(request, bodyHandler);
139+
return httpClient.send(requestBuilder.build(), bodyHandler);
141140
} catch (IOException e) {
142141
throw new HttpException(499, e);
143142
} catch (InterruptedException e) {
@@ -146,10 +145,6 @@ <T> HttpResponse<T> send(HttpRequest.Builder requestBuilder, HttpResponse.BodyHa
146145
}
147146
}
148147

149-
private HttpRequest.Builder applyFilters(HttpRequest.Builder hreq) {
150-
return hreq;
151-
}
152-
153148
BodyContent write(Object bean, String contentType) {
154149
return bodyAdapter.beanWriter(bean.getClass()).write(bean, contentType);
155150
}

client/src/main/java/io/avaje/http/client/HttpApi.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

client/src/test/java/org/example/github/GithubTest.java

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

33
import com.fasterxml.jackson.databind.DeserializationFeature;
44
import com.fasterxml.jackson.databind.ObjectMapper;
5-
import io.avaje.http.client.HttpApi;
65
import io.avaje.http.client.HttpClientContext;
76
import io.avaje.http.client.JacksonBodyAdapter;
87
import org.junit.jupiter.api.Disabled;
@@ -25,7 +24,8 @@ void test() {
2524
.withBodyAdapter(bodyAdapter)
2625
.build();
2726

28-
final Simple simple = HttpApi.provide(Simple.class, clientContext);
27+
// will not work under module classpath without registering the HttpApiProvider
28+
final Simple simple = clientContext.create(Simple.class);
2929

3030
final List<Repo> repos = simple.listRepos("rbygrave", "junk");
3131
assertThat(repos).isNotEmpty();

client/src/test/java/org/example/github/SimpleHttpClient.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
package org.example.github;
22

3-
import io.avaje.http.client.BodyReader;
4-
import io.avaje.http.client.BodyWriter;
5-
import io.avaje.http.client.HttpApiProvider;
6-
import io.avaje.http.client.HttpClientContext;
7-
import io.avaje.http.client.HttpException;
83
import io.avaje.http.api.Get;
94
import io.avaje.http.api.Post;
5+
import io.avaje.http.client.*;
106

117
import java.io.InputStream;
128
import java.net.http.HttpResponse;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.example.github;
2+
3+
import io.avaje.http.client.HttpApiProvider;
4+
import io.avaje.http.client.HttpClientContext;
5+
6+
public class SimpleProvider implements HttpApiProvider<Simple> {
7+
8+
@Override
9+
public Class<Simple> type() {
10+
return Simple.class;
11+
}
12+
13+
@Override
14+
public Simple provide(HttpClientContext client) {
15+
return new SimpleHttpClient(client);
16+
}
17+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.example.github.SimpleProvider

0 commit comments

Comments
 (0)