Skip to content

Commit 463a1cd

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

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,21 @@ public class Http2Client implements Client, AsyncClient<Object> {
5252

5353
private final HttpClient client;
5454

55+
/**
56+
* Creates the new Http2Client using following defaults:
57+
* <ul>
58+
* <li>Connect Timeout: 10 seconds, as {@link Request.Options#Options()} uses</li>
59+
* <li>Follow all 3xx redirects</li>
60+
* <li>HTTP 2</li>
61+
* </ul>
62+
*
63+
* @see Request.Options#Options()
64+
*/
5565
public Http2Client() {
5666
this(HttpClient.newBuilder()
5767
.followRedirects(Redirect.ALWAYS)
5868
.version(Version.HTTP_2)
69+
.connectTimeout(Duration.ofMillis(10000))
5970
.build());
6071
}
6172

0 commit comments

Comments
 (0)