记得上下班打卡 | git大法好,push需谨慎

Commit 8104eb9b authored by 张国柄's avatar 张国柄

HTTP GET请求调整;

parent 6aa83d18
......@@ -333,20 +333,20 @@ public class HttpUtil {
HttpEntity<Object> httpEntity = new HttpEntity(httpHeaders);
MultiValueMap<String, String> multiValueMap = (MultiValueMap<String, String>)params;
String paramStr = "";
if(multiValueMap.size()>0){
if(url.indexOf("?")<0){
if(multiValueMap.size()>0) {
if (!url.contains("?")) {
// 提交方式:表单、json
for(String key:multiValueMap.keySet()){
for (String key : multiValueMap.keySet()) {
try {
String value = multiValueMap.get(key).get(0).toString();
paramStr = paramStr.concat("&"+key+"="+value);
String value = multiValueMap.get(key).get(0);
paramStr = paramStr.concat("&" + key + "=" + value);
} catch (Exception e) {
e.printStackTrace();
}
}
url = url.concat("?").concat(paramStr);
System.out.println("url=="+url);
// System.out.println("url=="+url);
}
ResponseEntity<String> response = restTemplate.exchange(url, method, httpEntity, String.class);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment