mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix test
This commit is contained in:
parent
884ac2e765
commit
05c679bfc5
@ -74,6 +74,7 @@ public class StreamCopier extends IoCopier<InputStream, OutputStream> {
|
||||
if (null != progress) {
|
||||
progress.finish();
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.body.MultipartBody;
|
||||
import cn.hutool.http.cookie.GlobalCookieManager;
|
||||
import cn.hutool.http.ssl.SSLSocketFactoryBuilder;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
@ -883,7 +882,7 @@ public class HttpRequest extends HttpBase<HttpRequest> {
|
||||
*
|
||||
* @param protocol 协议
|
||||
* @return this
|
||||
* @see SSLSocketFactoryBuilder
|
||||
* @see SSLUtil#createSSLContext(String)
|
||||
* @see #setSSLSocketFactory(SSLSocketFactory)
|
||||
*/
|
||||
public HttpRequest setSSLProtocol(String protocol) {
|
||||
|
@ -467,7 +467,7 @@ public class HttpResponse extends HttpBase<HttpResponse> implements Closeable {
|
||||
final FastByteArrayOutputStream out = contentLength > 0 ?
|
||||
new FastByteArrayOutputStream(contentLength) : new FastByteArrayOutputStream();
|
||||
try {
|
||||
IoUtil.copy(in, out, -1, -1, null);
|
||||
IoUtil.copy(in, out, -1, contentLength, null);
|
||||
} catch (IORuntimeException e) {
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (e.getCause() instanceof EOFException || StrUtil.containsIgnoreCase(e.getMessage(), "Premature EOF")) {
|
||||
|
@ -56,7 +56,7 @@ public class HttpUtilTest {
|
||||
@Ignore
|
||||
public void getTest3() {
|
||||
// 测试url中带有空格的情况
|
||||
String result1 = HttpUtil.get("http://122.152.198.206:5000/kf?abc= d");
|
||||
String result1 = HttpUtil.get("http://hutool.cn:5000/kf?abc= d");
|
||||
Console.log(result1);
|
||||
}
|
||||
|
||||
@ -84,8 +84,9 @@ public class HttpUtilTest {
|
||||
@Test
|
||||
@Ignore
|
||||
public void get12306Test() {
|
||||
String result = HttpUtil.get("https://kyfw.12306.cn/otn/");
|
||||
Console.log(result);
|
||||
HttpRequest.get("https://kyfw.12306.cn/otn/")
|
||||
.setFollowRedirects(true)
|
||||
.then(response -> Console.log(response.body()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user