Skip to content

Commit

Permalink
Use headers to send the request
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoox committed Oct 15, 2020
1 parent 01046f8 commit 79c9461
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,15 @@ CompletableFuture<AggregatedHttpResponse> sendRequest() {
final HttpResponse response;
try (SafeCloseable ignored =
Clients.withContextCustomizer(ctx -> ctx.logBuilder().name(name))) {
HttpRequestWriter httpRequest = HttpRequest.streaming(request.headers());
response = httpClient.execute(httpRequest);
request.writeBody(httpRequest::tryWrite);
httpRequest.close();
final RequestHeaders headers = request.headers();
if (headers.isEndOfStream()) {
response = httpClient.execute(headers);
} else {
HttpRequestWriter httpRequest = HttpRequest.streaming(headers);
response = httpClient.execute(httpRequest);
request.writeBody(httpRequest::tryWrite);
httpRequest.close();
}
}
CompletableFuture<AggregatedHttpResponse> responseFuture =
RequestContext.mapCurrent(
Expand Down

0 comments on commit 79c9461

Please sign in to comment.