Skip to content

Commit 6dd2a86

Browse files
committed
📝 更新 README.md
1 parent 0ea0715 commit 6dd2a86

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323

2424
- 默认会按照下面的优先级自行寻找底层实现,`java 11 HttpClient -> OkHttp3 -> apache HttpClient -> hutool-http`
2525
- 也可以自行实现 `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);
33+
String s = HttpUtil.get("https://www.google.com");
34+
System.out.println("s = " + s);
35+
```
2636

2737
## TODO
2838

0 commit comments

Comments
 (0)