We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7591e81 commit edbce39Copy full SHA for edbce39
README.md
@@ -24,12 +24,11 @@
24
- 默认会按照下面的优先级自行寻找底层实现,`java 11 HttpClient -> OkHttp3 -> apache HttpClient -> hutool-http`
25
- 也可以自行实现 `com.xkcoding.http.support.Http` 接口,通过 `HttpUtil.setHttp(new MyHttpImpl())` 设置进来
26
- 可以配置超时时间及代理
27
-
28
```java
29
-HttpConfig config = new HttpConfig();
30
-config.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 10080)));
31
-config.setTimeout(15000);
32
-HttpUtil.setConfig(config);
+HttpUtil.setConfig(HttpConfig.builder()
+ .timeout(Constants.DEFAULT_TIMEOUT)
+ .proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 10080)))
+ .build());
33
String s = HttpUtil.get("https://www.google.com");
34
System.out.println("s = " + s);
35
```
0 commit comments