This commit is contained in:
雷欧(林平凡)
2025-08-15 11:32:43 +08:00
parent 75ffa2ad54
commit 72c51de7f8
2 changed files with 55 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ import org.springframework.http.MediaType;
/**
* 通用http发送方法
*
*
* @author ruoyi
*/
public class HttpUtils
@@ -129,10 +129,21 @@ public class HttpUtils
{
return sendPost(url, param, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
}
/**
* 向指定 URL 发送POST方法的请求请求体为JSON格式
*
* @param url 发送请求的 URL
* @param json JSON格式的请求体
* @return 所代表远程资源的响应结果
*/
public static String sendJsonPost(String url, String json)
{
return sendPost(url, json, MediaType.APPLICATION_JSON_VALUE);
}
/**
* 向指定 URL 发送POST方法的请求
*
*
* @param url 发送请求的 URL
* @param param 请求参数
* @param contentType 内容类型
@@ -290,4 +301,4 @@ public class HttpUtils
return true;
}
}
}
}