Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
httpclient4 新增 HttpClientUtil.getResponseBodyAsString(String,
Browse files Browse the repository at this point in the history
Map<String, String>, String) fix #19
  • Loading branch information
venusdrogon committed Mar 21, 2018
1 parent 93fc97f commit 13a0d7d
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ public static String post(String uri,String requestBody){
return getResponseBodyAsString(httpRequest);
}

//---------------------------------------------------------------

/**
* 发送请求,获得请求的响应内容.
* <h3>示例:</h3>
Expand Down Expand Up @@ -774,6 +776,44 @@ public static String getResponseBodyAsString(HttpRequest httpRequest){
return getResponseBodyAsString(httpRequest, null);
}

/**
* 发送请求,获得请求的响应内容.
*
* @param uri
* the uri
* @param requestParamMap
* the request param map
* @param httpMethod
* the method
* @return 如果 <code>uri</code> 是null,抛出 {@link NullPointerException}<br>
* 如果 <code>uri</code> 是blank,抛出 {@link IllegalArgumentException}<br>
* @since 1.11.0
*/
public static String getResponseBodyAsString(String uri,Map<String, String> requestParamMap,String httpMethod){
Validate.notBlank(uri, "uri can't be blank!");
return getResponseBodyAsString(new HttpRequest(uri, requestParamMap, httpMethod), null);
}

/**
* 发送请求,获得请求的响应内容.
*
* @param uri
* the uri
* @param requestParamMap
* the request param map
* @param httpMethodType
* the http method type
* @return 如果 <code>uri</code> 是null,抛出 {@link NullPointerException}<br>
* 如果 <code>uri</code> 是blank,抛出 {@link IllegalArgumentException}<br>
* @since 1.11.0
*/
public static String getResponseBodyAsString(String uri,Map<String, String> requestParamMap,HttpMethodType httpMethodType){
Validate.notBlank(uri, "uri can't be blank!");
return getResponseBodyAsString(new HttpRequest(uri, requestParamMap, httpMethodType), null);
}

//---------------------------------------------------------------

/**
* 发送请求,获得请求的响应内容.
*
Expand Down

0 comments on commit 13a0d7d

Please sign in to comment.