mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
f226b8418a
commit
9bcaa20d1a
@ -114,6 +114,9 @@ public class HttpClient4Engine implements ClientEngine {
|
|||||||
if (null != sslInfo) {
|
if (null != sslInfo) {
|
||||||
clientBuilder.setSSLSocketFactory(buildSocketFactory(sslInfo));
|
clientBuilder.setSSLSocketFactory(buildSocketFactory(sslInfo));
|
||||||
}
|
}
|
||||||
|
if(config.isDisableCache()){
|
||||||
|
clientBuilder.disableAuthCaching();
|
||||||
|
}
|
||||||
|
|
||||||
clientBuilder.setDefaultRequestConfig(buildRequestConfig(config));
|
clientBuilder.setDefaultRequestConfig(buildRequestConfig(config));
|
||||||
}
|
}
|
||||||
@ -121,6 +124,9 @@ public class HttpClient4Engine implements ClientEngine {
|
|||||||
// 设置默认头信息
|
// 设置默认头信息
|
||||||
clientBuilder.setDefaultHeaders(toHeaderList(GlobalHeaders.INSTANCE.headers()));
|
clientBuilder.setDefaultHeaders(toHeaderList(GlobalHeaders.INSTANCE.headers()));
|
||||||
|
|
||||||
|
// 默认关闭自动重定向
|
||||||
|
clientBuilder.disableRedirectHandling();
|
||||||
|
|
||||||
// 设置代理
|
// 设置代理
|
||||||
setProxy(clientBuilder, config);
|
setProxy(clientBuilder, config);
|
||||||
|
|
||||||
|
@ -117,11 +117,17 @@ public class HttpClient5Engine implements ClientEngine {
|
|||||||
if (null != config) {
|
if (null != config) {
|
||||||
clientBuilder.setConnectionManager(buildConnectionManager(config));
|
clientBuilder.setConnectionManager(buildConnectionManager(config));
|
||||||
clientBuilder.setDefaultRequestConfig(buildRequestConfig(config));
|
clientBuilder.setDefaultRequestConfig(buildRequestConfig(config));
|
||||||
|
if(config.isDisableCache()){
|
||||||
|
clientBuilder.disableAuthCaching();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置默认头信息
|
// 设置默认头信息
|
||||||
clientBuilder.setDefaultHeaders(toHeaderList(GlobalHeaders.INSTANCE.headers()));
|
clientBuilder.setDefaultHeaders(toHeaderList(GlobalHeaders.INSTANCE.headers()));
|
||||||
|
|
||||||
|
// 默认关闭自动重定向
|
||||||
|
clientBuilder.disableRedirectHandling();
|
||||||
|
|
||||||
// 设置代理
|
// 设置代理
|
||||||
setProxy(clientBuilder, config);
|
setProxy(clientBuilder, config);
|
||||||
|
|
||||||
|
@ -111,6 +111,9 @@ public class OkHttpEngine implements ClientEngine {
|
|||||||
setProxy(builder, config);
|
setProxy(builder, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 默认关闭自动跳转
|
||||||
|
builder.followRedirects(false);
|
||||||
|
|
||||||
this.client = builder.build();
|
this.client = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user