Skip to content

Commit

Permalink
Polish.
Browse files Browse the repository at this point in the history
  • Loading branch information
nstdio committed Mar 22, 2022
1 parent fedf8b8 commit 0739bc4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public <T> CompletableFuture<HttpResponse<T>> sendAsync(HttpRequest request, Bod
}

private <T> CompletableFuture<HttpResponse<T>> send0(HttpRequest request, BodyHandler<T> bodyHandler, Sender<T> sender) {
Chain<T> chain = buildAndExecute(request, bodyHandler);
Chain<T> chain = buildAndExecute(RequestContext.of(request, bodyHandler));
FutureHandler<T> handler = chain.futureHandler();

var future = chain.response()
Expand All @@ -176,7 +176,7 @@ private <T> CompletableFuture<HttpResponse<T>> send0(HttpRequest request, BodyHa
return future.isDone() ? future.handle(handler) : future.handleAsync(handler);
}

private <T> Chain<T> buildAndExecute(HttpRequest request, BodyHandler<T> bodyHandler) {
private <T> Chain<T> buildAndExecute(RequestContext ctx) {
List<Interceptor> interceptors = new ArrayList<>(2);
if (transparentEncoding) {
interceptors.add(new CompressionInterceptor());
Expand All @@ -185,7 +185,7 @@ private <T> Chain<T> buildAndExecute(HttpRequest request, BodyHandler<T> bodyHan
interceptors.add(new CachingInterceptor(cache, clock));
}

Chain<T> chain = Chain.of(RequestContext.of(request, bodyHandler));
Chain<T> chain = Chain.of(ctx);
if (!interceptors.isEmpty()) {
for (var interceptor : interceptors) {
chain = interceptor.intercept(chain);
Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/github/nstdio/http/ext/Interceptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@

interface Interceptor {
<T> Chain<T> intercept(Chain<T> in);

}

0 comments on commit 0739bc4

Please sign in to comment.