Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The HTTP protocol version: it misses in AsyncApacheHttp5Client's response and hardcoded in Request.toString() #2097

Merged
merged 2 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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