mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -32,7 +32,7 @@ public class IssueIAFKWPTest {
|
||||
@Test
|
||||
void urlWithFormTest() {
|
||||
final JSONObject obj = JSONUtil.ofObj();
|
||||
obj.set("fields", ListUtil.of("1", "2", "good"));
|
||||
obj.putObj("fields", ListUtil.of("1", "2", "good"));
|
||||
|
||||
final Map<String, Object> params = new HashMap<>();
|
||||
params.put("query", obj.toString());
|
||||
|
@@ -38,8 +38,8 @@ public class RestTest {
|
||||
final Request request = Request.of("http://localhost:8090/rest/restTest/")
|
||||
.method(Method.POST)
|
||||
.body(JSONUtil.ofObj()
|
||||
.set("aaa", "aaaValue")
|
||||
.set("键2", "值2").toString());
|
||||
.putObj("aaa", "aaaValue")
|
||||
.putObj("键2", "值2").toString());
|
||||
Assertions.assertEquals("application/json;charset=UTF-8", request.header(HeaderName.CONTENT_TYPE));
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ public class RestTest {
|
||||
final Request request = Request.of("http://localhost:8090/rest/restTest/")
|
||||
.method(Method.POST)
|
||||
.body(JSONUtil.ofObj()
|
||||
.set("aaa", "aaaValue")
|
||||
.set("键2", "值2").toString());
|
||||
.putObj("aaa", "aaaValue")
|
||||
.putObj("键2", "值2").toString());
|
||||
Console.log(request.send().body());
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ public class RestTest {
|
||||
@Disabled
|
||||
public void postTest2() {
|
||||
final String result = HttpUtil.post("http://localhost:8090/rest/restTest/", JSONUtil.ofObj()//
|
||||
.set("aaa", "aaaValue")
|
||||
.set("键2", "值2").toString());
|
||||
.putObj("aaa", "aaaValue")
|
||||
.putObj("键2", "值2").toString());
|
||||
Console.log(result);
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ public class RestTest {
|
||||
final Request request = Request.of("http://localhost:8888/restTest")//
|
||||
.header(HeaderName.CONTENT_TYPE, "application/json")
|
||||
.body(JSONUtil.ofObj()
|
||||
.set("aaa", "aaaValue")
|
||||
.set("键2", "值2").toString());
|
||||
.putObj("aaa", "aaaValue")
|
||||
.putObj("键2", "值2").toString());
|
||||
//noinspection resource
|
||||
Console.log(request.send().body());
|
||||
}
|
||||
|
@@ -44,9 +44,9 @@ public class SimpleServerTest {
|
||||
// 返回JSON数据测试
|
||||
.addAction("/restTest", (request, response) -> {
|
||||
final String res = JSONUtil.ofObj()
|
||||
.set("id", 1)
|
||||
.set("method", request.getMethod())
|
||||
.set("request", request.getBody())
|
||||
.putObj("id", 1)
|
||||
.putObj("method", request.getMethod())
|
||||
.putObj("request", request.getBody())
|
||||
.toStringPretty();
|
||||
response.write(res, ContentType.JSON.toString());
|
||||
})
|
||||
|
Reference in New Issue
Block a user