Skip to content

Commit

Permalink
The HTTP protocol version: it misses in AsyncApacheHttp5Client's resp…
Browse files Browse the repository at this point in the history
…onse and hardcoded in Request.toString() (#2097)

* Missed the HTTP protocol version in HC5. The hardcoded protocol version in Request.toString()

* Fix formatting
  • Loading branch information
vitalijr2 committed Jun 21, 2023
1 parent f1e2c19 commit e4d2bed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/main/java/feign/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ public ProtocolVersion protocolVersion() {
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append(httpMethod).append(' ').append(url).append(" HTTP/1.1\n");
builder.append(httpMethod).append(' ').append(url).append(' ').append(protocolVersion)
.append('\n');
for (final String field : headers.keySet()) {
for (final String value : valuesOrEmpty(headers, field)) {
builder.append(field).append(": ").append(value).append('\n');
Expand Down
3 changes: 3 additions & 0 deletions hc5/src/main/java/feign/hc5/AsyncApacheHttp5Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.concurrent.CompletableFuture;
import feign.*;
import feign.Request.Options;
import static feign.Util.enumForName;

/**
* This module directs Feign's http requests to Apache's
Expand Down Expand Up @@ -179,6 +180,8 @@ Response toFeignResponse(SimpleHttpResponse httpResponse, Request request) {
}

return Response.builder()
.protocolVersion(
enumForName(Request.ProtocolVersion.class, httpResponse.getVersion().format()))
.status(statusCode)
.reason(reason)
.headers(headers)
Expand Down

0 comments on commit e4d2bed

Please sign in to comment.