1 Star 0 Fork 953

jlcoding/jboot

forked from JbootProjects/jboot 
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
HttpTest.java 1.65 KB
Copy Edit Raw Blame History
Michael Yang authored 2017-12-25 18:05 +08:00 . 优化代码
import io.jboot.Jboot;
import io.jboot.core.http.JbootHttpRequest;
import io.jboot.core.http.JbootHttpResponse;
import org.junit.Test;
public class HttpTest {
@Test
public void testHttp() {
JbootHttpResponse response = Jboot.me().getHttp().handle(JbootHttpRequest.create("https://www.baidu.com"));
System.out.println(response.getContentType());
System.out.println(response.getHeaders());
}
@Test
public void testHttpGet() {
// String html = Jboot.httpGet("https://www.baidu.com");
// System.out.println(html);
}
@Test
public void testOkHttpGet() throws InterruptedException {
// Jboot.setBootArg("jboot.http.type", "okhttp");
// String html = Jboot.httpGet("https://www.baidu.com");
// System.out.println("babbb:" + html);
}
@Test
public void testHttpPost() {
// Map<String, Object> params = new HashMap<>();
// params.put("key1", "value1");
// params.put("key2", "value2");
//
//
// String html = Jboot.httpPost("http://www.oschina.net/", params);
// System.out.println(html);
}
@Test
public void testHttpDownload() {
// String url = "http://www.xxx.com/abc.zip";
//
// File downloadToFile = new File("/xxx/abc.zip");
//
//
// JbootHttpRequest request = JbootHttpRequest.create(url, null, JbootHttpRequest.METHOD_GET);
// request.setDownloadFile(downloadToFile);
//
//
// JbootHttpResponse response = Jboot.me().getHttp().handle(request);
//
// if (response.isError()){
// downloadToFile.delete();
// }
//
// System.out.println(downloadToFile.length());
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/msgcode/jboot.git
git@gitee.com:msgcode/jboot.git
msgcode
jboot
jboot
master

Search