This commit is contained in:
Looly
2020-04-25 18:50:48 +08:00
parent 2bcad6031d
commit e568b7896b
8 changed files with 147 additions and 49 deletions

View File

@@ -11,6 +11,10 @@ public class SimpleServerTest {
HttpUtil.createServer(8888)
// 设置默认根目录,
.setRoot("d:/test")
// get数据测试返回请求的PATH
.addAction("/get", (request, response) ->
response.write(request.getURI().toString(), ContentType.TEXT_PLAIN.toString())
)
// 返回JSON数据测试
.addAction("/restTest", (request, response) ->
response.write("{\"id\": 1, \"msg\": \"OK\"}", ContentType.JSON.toString())

View File

@@ -295,4 +295,13 @@ public class HttpUtilTest {
String mimeType = HttpUtil.getMimeType("aaa.aaa");
Assert.assertNull(mimeType);
}
@Test
@Ignore
public void getWeixinTest(){
// 测试特殊URL即URL中有&情况是否请求正常
String url = "https://mp.weixin.qq.com/s?__biz=MzI5NjkyNTIxMg==&mid=100000465&idx=1&sn=1044c0d19723f74f04f4c1da34eefa35&chksm=6cbda3a25bca2ab4516410db6ce6e125badaac2f8c5548ea6e18eab6dc3c5422cb8cbe1095f7";
final String s = HttpUtil.get(url);
Console.log(s);
}
}