Skip to content

Commit

Permalink
回滚对Http类的修改
Browse files Browse the repository at this point in the history
  • Loading branch information
wendal committed Oct 16, 2013
1 parent a4d9e36 commit f1e59ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/org/nutz/http/Http.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public static Response get(String url, int timeout) {
return Sender.create(Request.get(url)).setTimeout(timeout).send();
}

public static Response post(String url, Map<String, Object> params, int timeout) {
public static String post(String url, Map<String, Object> params, int timeout) {
return Sender.create(Request.create(url, METHOD.POST, params, null))
.setTimeout(timeout)
.send();
.send().getContent();
}

public static Response post(String url, Map<String, Object> params, String inenc, String reenc) {
return Sender.create(Request.create(url, METHOD.POST, params, null)).send();
public static String post(String url, Map<String, Object> params, String inenc, String reenc) {
return Sender.create(Request.create(url, METHOD.POST, params, null)).send().getContent();
}

public static String encode(Object s) {
Expand Down
3 changes: 1 addition & 2 deletions test/org/nutz/http/HttpTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ public void testPost() {
Map<String, Object> parms = new HashMap<String, Object>();
parms.put("version", "NutzTest");
parms.put("website", Nutz.version());
String response = Http.post("http://nutztest.herokuapp.com/", parms, "utf-8", "utf-8")
.getContent();
String response = Http.post("http://nutztest.herokuapp.com/", parms, "utf-8", "utf-8");
assertNotNull(response);
assertTrue(response.length() > 0);
// 该post的返回值是"version: #{params[:version]}, website: #{params[:website]}"
Expand Down

0 comments on commit f1e59ad

Please sign in to comment.