Skip to content

Commit 57377b3

Browse files
committed
test: 1.5.33
1 parent 5ebb933 commit 57377b3

File tree

7 files changed

+65
-12
lines changed

7 files changed

+65
-12
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Forest是一个高层的、极简的声明式HTTP调用API框架<br>
4444
-------------------------------------
4545
* [项目主页](http://forest.dtflyx.com/)
4646

47-
* [中文文档](https://forest.dtflyx.com/pages/1.5.32/intro/)
47+
* [中文文档](https://forest.dtflyx.com/pages/1.5.33/intro/)
4848

4949
* [JavaDoc](https://apidoc.gitee.com/dt_flys/forest/)
5050

@@ -86,7 +86,7 @@ Forest有哪些特性?
8686
<dependency>
8787
<groupId>com.dtflys.forest</groupId>
8888
<artifactId>forest-spring-boot-starter</artifactId>
89-
<version>1.5.32</version>
89+
<version>1.5.33</version>
9090
</dependency>
9191
```
9292

forest-core/src/main/java/com/dtflys/forest/http/ForestProxy.java

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,26 @@ public String cacheKey() {
8585
return builder.toString();
8686
}
8787

88+
/**
89+
* 获取代理的协议类型
90+
*
91+
* @return 代理的协议类型
92+
* @since 1.5.33
93+
*/
8894
public ForestProxyType getType() {
8995
return type;
9096
}
9197

98+
/**
99+
* 获取代理的协议类型
100+
*
101+
* @return 代理的协议类型
102+
* @since 1.5.33
103+
*/
104+
public ForestProxyType type() {
105+
return type;
106+
}
107+
92108
/**
93109
* 获取代理主机地址
94110
*
@@ -98,6 +114,16 @@ public String getHost() {
98114
return host;
99115
}
100116

117+
/**
118+
* 获取代理主机地址
119+
*
120+
* @return 代理主机地址
121+
* @since 1.5.33
122+
*/
123+
public String host() {
124+
return host;
125+
}
126+
101127
/**
102128
* 获取代理主机端口
103129
*
@@ -107,6 +133,16 @@ public int getPort() {
107133
return port;
108134
}
109135

136+
/**
137+
* 获取代理主机端口
138+
*
139+
* @return 代理主机端口
140+
* @since 1.5.33
141+
*/
142+
public int port() {
143+
return port;
144+
}
145+
110146
/**
111147
* 获取代理用户名
112148
*
@@ -132,6 +168,7 @@ public ForestProxy setUsername(String username) {
132168
*
133169
* @param username 代理用户名
134170
* @return {@link ForestProxy}对象实例
171+
* @since 1.5.33
135172
*/
136173
public ForestProxy username(String username) {
137174
this.username = username;
@@ -143,6 +180,7 @@ public String getCharset() {
143180
return charset;
144181
}
145182

183+
146184
public ForestProxy setCharset(String charset) {
147185
this.charset = charset;
148186
return this;
@@ -154,6 +192,8 @@ public ForestProxy charset(String charset) {
154192
}
155193

156194

195+
196+
157197
/**
158198
* 获取代理密码
159199
*
@@ -178,7 +218,8 @@ public ForestProxy setPassword(String password) {
178218
* 获取代理密码
179219
*
180220
* @param password 代理密码
181-
* @return
221+
* @return {@link ForestProxy}类实例
222+
* @since 1.5.33
182223
*/
183224
public ForestProxy password(String password) {
184225
this.password = password;

forest-core/src/test/java/com/dtflys/test/http/proxy/HTTPProxyClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public interface HTTPProxyClient {
2323
ForestRequest<String> sendHostPortSocks(String host, int port);
2424

2525
@Post("/")
26-
@SocksProxy(host = "${0}", port = "${1}")
26+
@SocksProxy(host = "${0}", port = "${1}", username = "", password = "")
2727
ForestRequest<String> sendHostPortSocks2(String host, int port);
2828

2929

forest-core/src/test/java/com/dtflys/test/http/proxy/MyHTTPProxySource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ public class MyHTTPProxySource implements HTTPProxySource {
1212

1313
@Override
1414
public ForestProxy getProxy(ForestRequest request) {
15-
return new ForestProxy("127.0.0.1", (Integer) request.variableValue("port"));
15+
return ForestProxy.http("127.0.0.1", (Integer) request.variableValue("port"));
1616
}
1717
}

forest-solon-plugin/src/test/java/com/dtflys/forest/solon/test/Test0.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,29 @@ public void testRetry() {
134134
String backendName = backend.getName();
135135
Mockito.verify(logger).info("[Forest] Request (" + backendName + "): \n" +
136136
"\t[Retry]: 1\n" +
137-
"\tGET https://www.thebeastshop.com/autopage/shops.htm HTTPS");
137+
"\tGET https://www.thebeastshop.com/autopage/shops.htm HTTPS\n" +
138+
"\tHeaders: \n" +
139+
"\t\tUser-Agent: forest/1.5.33");
138140
Mockito.verify(logger).info("[Forest] Request (" + backendName + "): \n" +
139141
"\t[Retry]: 2\n" +
140-
"\tGET https://www.thebeastshop.com/autopage/shops.htm HTTPS");
142+
"\tGET https://www.thebeastshop.com/autopage/shops.htm HTTPS\n" +
143+
"\tHeaders: \n" +
144+
"\t\tUser-Agent: forest/1.5.33");
141145
Mockito.verify(logger).info("[Forest] Request (" + backendName + "): \n" +
142146
"\t[Retry]: 3\n" +
143-
"\tGET https://www.thebeastshop.com/autopage/shops.htm HTTPS");
147+
"\tGET https://www.thebeastshop.com/autopage/shops.htm HTTPS\n" +
148+
"\tHeaders: \n" +
149+
"\t\tUser-Agent: forest/1.5.33");
144150
Mockito.verify(logger).info("[Forest] Request (" + backendName + "): \n" +
145151
"\t[Retry]: 4\n" +
146-
"\tGET https://www.thebeastshop.com/autopage/shops.htm HTTPS");
152+
"\tGET https://www.thebeastshop.com/autopage/shops.htm HTTPS\n" +
153+
"\tHeaders: \n" +
154+
"\t\tUser-Agent: forest/1.5.33");
147155
Mockito.verify(logger).info("[Forest] Request (" + backendName + "): \n" +
148156
"\t[Retry]: 5\n" +
149-
"\tGET https://www.thebeastshop.com/autopage/shops.htm HTTPS");
157+
"\tGET https://www.thebeastshop.com/autopage/shops.htm HTTPS\n" +
158+
"\tHeaders: \n" +
159+
"\t\tUser-Agent: forest/1.5.33");
150160
// Mockito.verify(logger).info("[Forest] [Network Error]: connect timed out");
151161

152162
}

forest-solon-plugin/src/test/java/com/dtflys/forest/solon/test/Test2.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public void testClient2() {
5050
String result = (String) request.execute();
5151
assertThat(result.startsWith("Global: ")).isTrue();
5252
Mockito.verify(logger).info("[Forest] [Test2] 请求: \n" +
53-
"\tGET https://gitee.com/dt_flys HTTPS");
53+
"\tGET https://gitee.com/dt_flys HTTPS\n" +
54+
"\t请求头: \n" +
55+
"\t\tUser-Agent: forest/1.5.33");
5456
}
5557

5658

forest-solon-plugin/src/test/resources/app-test2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ forest:
88
read-timeout: 6000
99
max-retry-count: 0
1010
interceptors:
11-
com.dtflys.forest.solon.test.interceptor.GlobalInterceptor
11+
- com.dtflys.forest.solon.test.interceptor.GlobalInterceptor
1212

1313

1414
test:

0 commit comments

Comments
 (0)