diff --git a/servers/boe-server-all/src/main/java/com/xboe/module/course/utils/HttpUtils.java b/servers/boe-server-all/src/main/java/com/xboe/module/course/utils/HttpUtils.java index 9213fb04..260a4a0d 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/module/course/utils/HttpUtils.java +++ b/servers/boe-server-all/src/main/java/com/xboe/module/course/utils/HttpUtils.java @@ -7,6 +7,8 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; +import java.nio.charset.StandardCharsets; + /** * @author * @date 2025年11月18日 @@ -22,8 +24,9 @@ public class HttpUtils { // POST 请求 HttpPost httpPost = new HttpPost(url); //HttpPost httpPost = new HttpPost("https://jsonplaceholder.typicode.com/posts"); - httpPost.setEntity(new StringEntity(message)); - httpPost.setHeader("Content-Type", "application/json"); + httpPost.setEntity(new StringEntity(message, StandardCharsets.UTF_8)); + httpPost.setHeader("Content-Type", "application/json; charset=utf-8"); + httpPost.setHeader("Accept", "application/json"); CloseableHttpResponse response = httpClient.execute(httpPost); log.info("---------------发送消息响应 -------{}",response); return response;