mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -34,13 +34,13 @@ public class DownloadTest {
|
||||
@Ignore
|
||||
public void downloadSizeTest() {
|
||||
final String url = "https://res.t-io.org/im/upload/img/67/8948/1119501/88097554/74541310922/85/231910/366466 - 副本.jpg";
|
||||
HttpRequest.get(url).setSSLProtocol("TLSv1.2").executeAsync().writeBody("e:/pic/366466.jpg");
|
||||
HttpRequest.get(url).setSSLProtocol("TLSv1.2").executeAsync().body().write("e:/pic/366466.jpg");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void downloadTest1() {
|
||||
final long size = HttpUtil.downloadFile("http://explorer.bbfriend.com/crossdomain.xml", "e:/temp/");
|
||||
final File size = HttpUtil.downloadFile("http://explorer.bbfriend.com/crossdomain.xml", "e:/temp/");
|
||||
System.out.println("Download size: " + size);
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,7 @@ public class HttpRequestTest {
|
||||
@Test
|
||||
@Ignore
|
||||
public void getHttpsTest() {
|
||||
final String body = HttpRequest.get("https://www.hutool.cn/").timeout(10).execute().body();
|
||||
final String body = HttpRequest.get("https://www.hutool.cn/").timeout(10).execute().bodyStr();
|
||||
Console.log(body);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class HttpRequestTest {
|
||||
public void getCookiesTest() {
|
||||
// 检查在Connection关闭情况下Cookie是否可以正常获取
|
||||
final HttpResponse res = HttpRequest.get("https://www.oschina.net/").execute();
|
||||
final String body = res.body();
|
||||
final String body = res.bodyStr();
|
||||
Console.log(res.getCookies());
|
||||
Console.log(body);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class HttpRequestTest {
|
||||
@Test
|
||||
@Ignore
|
||||
public void bodyTest() {
|
||||
final String ddddd1 = HttpRequest.get("https://baijiahao.baidu.com/s").body("id=1625528941695652600").execute().body();
|
||||
final String ddddd1 = HttpRequest.get("https://baijiahao.baidu.com/s").body("id=1625528941695652600").execute().bodyStr();
|
||||
Console.log(ddddd1);
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@ public class HttpUtilTest {
|
||||
public void postTest() {
|
||||
final String result = HttpUtil.createPost("api.uhaozu.com/goods/description/1120448506")
|
||||
.charset(CharsetUtil.NAME_UTF_8)
|
||||
.execute().body();
|
||||
.execute().bodyStr();
|
||||
Console.log(result);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class HttpUtilTest {
|
||||
.createPost("http://cmp.ishanghome.com/cmp/v1/community/queryClusterCommunity")
|
||||
.header(Header.ACCEPT, "*/*")
|
||||
.execute()
|
||||
.body();
|
||||
.bodyStr();
|
||||
Console.log(result);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class HttpUtilTest {
|
||||
// 自定义的默认header无效
|
||||
final String result = HttpRequest
|
||||
.get("https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=101457313&redirect_uri=http%3A%2F%2Fwww.benmovip.com%2Fpay-cloud%2Fqqlogin%2FgetCode&state=ok")
|
||||
.removeHeader(Header.USER_AGENT).execute().body();
|
||||
.removeHeader(Header.USER_AGENT).execute().bodyStr();
|
||||
Console.log(result);
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ public class HttpUtilTest {
|
||||
@Ignore
|
||||
public void patchTest() {
|
||||
// 验证patch请求是否可用
|
||||
final String body = HttpRequest.patch("https://www.baidu.com").execute().body();
|
||||
final String body = HttpRequest.patch("https://www.baidu.com").execute().bodyStr();
|
||||
Console.log(body);
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ public class HttpUtilTest {
|
||||
@Ignore
|
||||
public void acplayTest(){
|
||||
final String body = HttpRequest.get("https://api.acplay.net/api/v2/bangumi/9541")
|
||||
.execute().body();
|
||||
.execute().bodyStr();
|
||||
Console.log(body);
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ public class IssueI5WAV4Test {
|
||||
map.put("flightID", 2879);
|
||||
|
||||
|
||||
final String body = HttpRequest.get("http://localhost:8884/api/test/testHttpUtilGetWithBody").body(JSONUtil.toJsonStr(map)).execute().body();
|
||||
final String body = HttpRequest.get("http://localhost:8884/api/test/testHttpUtilGetWithBody").body(JSONUtil.toJsonStr(map)).execute().bodyStr();
|
||||
System.out.println("使用hutool返回结果:" + body);
|
||||
}
|
||||
}
|
||||
|
@@ -83,7 +83,7 @@ public class UploadTest {
|
||||
.header(Header.USER_AGENT, "PostmanRuntime/7.28.4")
|
||||
.auth(token)
|
||||
.form("smfile", FileUtil.file("d:/test/qrcodeCustom.png"))
|
||||
.execute().body();
|
||||
.execute().bodyStr();
|
||||
|
||||
Console.log(result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user