Fix http client error

This commit is contained in:
nkorange 2019-03-08 10:43:26 +08:00
parent fb8cf7d3b6
commit 6ae100e390

View File

@ -69,7 +69,7 @@ public class HttpClient {
HttpURLConnection conn = null; HttpURLConnection conn = null;
try { try {
String encodedContent = encodingParams(paramValues, encoding); String encodedContent = encodingParams(paramValues, encoding);
url += (null == encodedContent) ? "" : ("?" + encodedContent); url += (StringUtils.isEmpty(encodedContent)) ? "" : ("?" + encodedContent);
conn = (HttpURLConnection) new URL(url).openConnection(); conn = (HttpURLConnection) new URL(url).openConnection();
@ -174,7 +174,7 @@ public class HttpClient {
private static String encodingParams(Map<String, String> params, String encoding) private static String encodingParams(Map<String, String> params, String encoding)
throws UnsupportedEncodingException { throws UnsupportedEncodingException {
if (null == params || params.isEmpty()) { if (null == params || params.isEmpty()) {
return null; return "";
} }
params.put("encoding", encoding); params.put("encoding", encoding);