Skip to content

Commit ff7f782

Browse files
authored
[java11] Add default timeout value as Request.Options uses (#1532)
1 parent 7c28059 commit ff7f782

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

java11/src/main/java/feign/http2client/Http2Client.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,24 @@ public class Http2Client implements Client, AsyncClient<Object> {
5252

5353
private final HttpClient client;
5454

55+
/**
56+
* Creates the new Http2Client using following defaults:
57+
*
58+
* <ul>
59+
* <li>Connect Timeout: 10 seconds, as {@link Request.Options#Options()} uses
60+
* <li>Follow all 3xx redirects
61+
* <li>HTTP 2
62+
* </ul>
63+
*
64+
* @see Request.Options#Options()
65+
*/
5566
public Http2Client() {
56-
this(HttpClient.newBuilder().followRedirects(Redirect.ALWAYS).version(Version.HTTP_2).build());
67+
this(
68+
HttpClient.newBuilder()
69+
.followRedirects(Redirect.ALWAYS)
70+
.version(Version.HTTP_2)
71+
.connectTimeout(Duration.ofMillis(10000))
72+
.build());
5773
}
5874

5975
public Http2Client(Options options) {

0 commit comments

Comments
 (0)