Skip to content

Commit 33f6b50

Browse files
authored
Merge branch 'dev' into Improvement-17874
2 parents 8bfdb4d + 418f012 commit 33f6b50

File tree

1 file changed

+8
-4
lines changed
  • dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http

1 file changed

+8
-4
lines changed

dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
import lombok.SneakyThrows;
3838
import lombok.extern.slf4j.Slf4j;
3939

40+
import com.fasterxml.jackson.core.type.TypeReference;
41+
4042
@Slf4j
4143
public final class HttpSender {
4244

4345
private Map<String, String> headerParams;
4446
private OkHttpRequestHeaderContentType contentType;
45-
private Map<String, String> bodyParams;
47+
private Map<String, Object> bodyParams;
4648
private HttpRequestMethod requestType;
4749
private int timeout;
4850
private String url;
@@ -69,7 +71,8 @@ private void paramsValidator(Map<String, String> paramsMap) {
6971

7072
String bodyParamsString = paramsMap.get(HttpAlertConstants.NAME_BODY_PARAMS);
7173
if (StringUtils.isNotBlank(bodyParamsString)) {
72-
bodyParams = JSONUtils.toMap(bodyParamsString);
74+
bodyParams = JSONUtils.parseObject(bodyParamsString, new TypeReference<Map<String, Object>>() {
75+
});
7376
if (bodyParams == null) {
7477
throw new IllegalArgumentException("bodyParams is not a valid json");
7578
}
@@ -215,8 +218,9 @@ private void setMsgInRequestBody(String msg) {
215218
}
216219

217220
bodyParams.forEach((key, value) -> {
218-
if (value.contains(HttpAlertConstants.MSG_PARAMS)) {
219-
bodyParams.put(key, value.replace(HttpAlertConstants.MSG_PARAMS, msg));
221+
String valueOf = String.valueOf(value);
222+
if (valueOf.contains(HttpAlertConstants.MSG_PARAMS)) {
223+
bodyParams.put(key, valueOf.replace(HttpAlertConstants.MSG_PARAMS, msg));
220224
}
221225
});
222226
}

0 commit comments

Comments
 (0)