Skip to content

Commit e4d2bed

Browse files
authored
The HTTP protocol version: it misses in AsyncApacheHttp5Client's response and hardcoded in Request.toString() (#2097)
* Missed the HTTP protocol version in HC5. The hardcoded protocol version in Request.toString() * Fix formatting
1 parent f1e2c19 commit e4d2bed

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/src/main/java/feign/Request.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ public ProtocolVersion protocolVersion() {
276276
@Override
277277
public String toString() {
278278
final StringBuilder builder = new StringBuilder();
279-
builder.append(httpMethod).append(' ').append(url).append(" HTTP/1.1\n");
279+
builder.append(httpMethod).append(' ').append(url).append(' ').append(protocolVersion)
280+
.append('\n');
280281
for (final String field : headers.keySet()) {
281282
for (final String value : valuesOrEmpty(headers, field)) {
282283
builder.append(field).append(": ").append(value).append('\n');

hc5/src/main/java/feign/hc5/AsyncApacheHttp5Client.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.concurrent.CompletableFuture;
2929
import feign.*;
3030
import feign.Request.Options;
31+
import static feign.Util.enumForName;
3132

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

181182
return Response.builder()
183+
.protocolVersion(
184+
enumForName(Request.ProtocolVersion.class, httpResponse.getVersion().format()))
182185
.status(statusCode)
183186
.reason(reason)
184187
.headers(headers)

0 commit comments

Comments
 (0)