|
|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.ruoyi.platform.utils; |
|
|
|
|
|
|
|
import cn.hutool.http.HttpRequest; |
|
|
|
import com.ruoyi.common.core.utils.StringUtils; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.http.HttpEntity; |
|
|
|
@@ -305,9 +306,9 @@ public class HttpUtils { |
|
|
|
conn.setRequestProperty("contentType", "utf-8"); |
|
|
|
conn.setDoOutput(true); |
|
|
|
conn.setDoInput(true); |
|
|
|
out = new PrintWriter(conn.getOutputStream()); |
|
|
|
out.print(param); |
|
|
|
out.flush(); |
|
|
|
out = new PrintWriter(conn.getOutputStream()); |
|
|
|
out.print(param); |
|
|
|
out.flush(); |
|
|
|
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); |
|
|
|
String line; |
|
|
|
while ((line = in.readLine()) != null) { |
|
|
|
@@ -337,6 +338,19 @@ public class HttpUtils { |
|
|
|
return result.toString(); |
|
|
|
} |
|
|
|
|
|
|
|
public static String sendPost(String url, String param, String body){ |
|
|
|
String urlNameString = url; |
|
|
|
if (StringUtils.isNotEmpty(param)) { |
|
|
|
urlNameString = url + "?" + param; |
|
|
|
} |
|
|
|
String response = HttpRequest.post(urlNameString) |
|
|
|
.body(body) // 设置请求体 |
|
|
|
.contentType("application/json") // 设置Content-Type |
|
|
|
.execute() |
|
|
|
.body(); |
|
|
|
return response; |
|
|
|
} |
|
|
|
|
|
|
|
public static String sendSSLPost(String url, String param) { |
|
|
|
StringBuilder result = new StringBuilder(); |
|
|
|
String urlNameString = url + "?" + param; |
|
|
|
|