Skip to content

Commit 54ccd9a

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 c3766ca commit 54ccd9a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,13 @@ public ProtocolVersion protocolVersion() {
290290
@Override
291291
public String toString() {
292292
final StringBuilder builder = new StringBuilder();
293-
builder.append(httpMethod).append(' ').append(url).append(" HTTP/1.1\n");
293+
builder
294+
.append(httpMethod)
295+
.append(' ')
296+
.append(url)
297+
.append(' ')
298+
.append(protocolVersion)
299+
.append('\n');
294300
for (final String field : headers.keySet()) {
295301
for (final String value : valuesOrEmpty(headers, field)) {
296302
builder.append(field).append(": ").append(value).append('\n');

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
*/
1414
package feign.hc5;
1515

16+
import static feign.Util.enumForName;
17+
1618
import feign.*;
1719
import feign.Request.Options;
1820
import java.util.*;
@@ -179,6 +181,8 @@ Response toFeignResponse(SimpleHttpResponse httpResponse, Request request) {
179181
}
180182

181183
return Response.builder()
184+
.protocolVersion(
185+
enumForName(Request.ProtocolVersion.class, httpResponse.getVersion().format()))
182186
.status(statusCode)
183187
.reason(reason)
184188
.headers(headers)

0 commit comments

Comments
 (0)