diff --git a/src/test/java/com/ecfront/dew/common/HttpHelperTest.java b/src/test/java/com/ecfront/dew/common/HttpHelperTest.java index ebb36f5..50bf31a 100644 --- a/src/test/java/com/ecfront/dew/common/HttpHelperTest.java +++ b/src/test/java/com/ecfront/dew/common/HttpHelperTest.java @@ -40,8 +40,7 @@ public void testHttp() throws Exception { Assert.assertEquals("1", $.json.toJson(result).get("form").get("a").asText()); // post - file result = $.http.post("https://httpbin.org/post", new File(this.getClass().getResource("/").getPath() + "conf1.json")); - System.out.println(result); - Assert.assertEquals("{\r\n \"a\":1\r\n}", $.json.toJson(result).get("files").get("conf1.json").asText()); + Assert.assertEquals("1", $.json.toJson($.json.toJson(result).get("files").get("conf1.json").asText()).get("a").asText()); // put - data result = $.http.put("https://httpbin.org/put", "some data"); Assert.assertEquals("some data", $.json.toJson(result).get("data").asText()); @@ -52,10 +51,10 @@ public void testHttp() throws Exception { Assert.assertEquals("1", $.json.toJson(result).get("form").get("a").asText()); // put - file result = $.http.put("https://httpbin.org/put", new File(this.getClass().getResource("/").getPath() + "conf1.json")); - Assert.assertEquals("{\r\n \"a\":1\r\n}", $.json.toJson(result).get("files").get("conf1.json").asText()); + Assert.assertEquals("1", $.json.toJson($.json.toJson(result).get("files").get("conf1.json").asText()).get("a").asText()); // put with head HttpHelper.WrapHead wrapHead = $.http.putWithHead("https://httpbin.org/put", new File(this.getClass().getResource("/").getPath() + "conf1.json")); - Assert.assertEquals("{\r\n \"a\":1\r\n}", $.json.toJson(wrapHead.result).get("files").get("conf1.json").asText()); + Assert.assertEquals("1", $.json.toJson($.json.toJson(result).get("files").get("conf1.json").asText()).get("a").asText()); Assert.assertEquals("application/json", wrapHead.head.get("Content-Type")); // head Map head = $.http.head("https://httpbin.org/get");