add methods

This commit is contained in:
Looly
2021-08-02 20:16:04 +08:00
parent 72af4101bc
commit 08ebcad848
14 changed files with 209 additions and 32 deletions

View File

@@ -31,7 +31,6 @@ import java.net.Proxy;
import java.net.URLStreamHandler;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**

View File

@@ -8,7 +8,7 @@ import org.junit.Test;
/**
* Rest类型请求单元测试
*
*
* @author looly
*
*/
@@ -52,4 +52,16 @@ public class RestTest {
.set("键2", "值2").toString());
Console.log(request.execute().body());
}
@Test
@Ignore
public void getWithBodyTest2() {
HttpRequest request = HttpRequest.get("https://ad.oceanengine.com/open_api/2/advertiser/info/")//
.setHttpProxy("localhost", 8888)
.header("Access-Token","b91e44f37ff2544079ceabcfafaf02bd3db9b769")
.body(JSONUtil.createObj()
.set("advertiser_ids", new Long[] {1690657248243790L})
.set("fields", new String[] {"id", "name", "status"}).toString());
Console.log(request.execute().body());
}
}

View File

@@ -26,6 +26,7 @@ public class SimpleServerTest {
String res = JSONUtil.createObj()
.set("id", 1)
.set("method", request.getMethod())
.set("request", request.getBody())
.toStringPretty();
response.write(res, ContentType.JSON.toString());
})