diff --git a/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/SentinelApiClient.java b/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/SentinelApiClient.java index ec27e26c..79e44818 100755 --- a/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/SentinelApiClient.java +++ b/sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/SentinelApiClient.java @@ -62,6 +62,7 @@ import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig; import com.alibaba.csp.sentinel.dashboard.util.VersionUtils; +import org.apache.http.Consts; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; @@ -175,12 +176,7 @@ public class SentinelApiClient { for (Entry entry : params.entrySet()) { list.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } - try { - httpPost.setEntity(new UrlEncodedFormEntity(list)); - } catch (UnsupportedEncodingException e) { - logger.warn("httpPostContent encode entity error: {}", params, e); - return null; - } + httpPost.setEntity(new UrlEncodedFormEntity(list, Consts.UTF_8)); } return httpPost; } diff --git a/sentinel-transport/sentinel-transport-simple-http/src/main/java/com/alibaba/csp/sentinel/transport/command/http/HttpEventTask.java b/sentinel-transport/sentinel-transport-simple-http/src/main/java/com/alibaba/csp/sentinel/transport/command/http/HttpEventTask.java index 80df0955..1c36ec86 100755 --- a/sentinel-transport/sentinel-transport-simple-http/src/main/java/com/alibaba/csp/sentinel/transport/command/http/HttpEventTask.java +++ b/sentinel-transport/sentinel-transport-simple-http/src/main/java/com/alibaba/csp/sentinel/transport/command/http/HttpEventTask.java @@ -113,6 +113,10 @@ public class HttpEventTask implements Runnable { String headerName = bodyLine.substring(0, index); String header = bodyLine.substring(index + 1).trim(); if (StringUtil.equalsIgnoreCase("content-type", headerName)) { + int idx = header.indexOf(";"); + if (idx > 0){ + header = header.substring(0, idx).trim(); + } if (StringUtil.equals("application/x-www-form-urlencoded", header)) { supported = true; } else {