This is an automated email from the ASF dual-hosted git repository.
wenjun pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 418f012cc6 [Fix-17912] Fix http plugin cannot send json nested types
(#17911)
418f012cc6 is described below
commit 418f012cc66b01de449e9b57aa25d57e58eba277
Author: Alexander1902 <[email protected]>
AuthorDate: Thu Jan 29 15:05:38 2026 +0800
[Fix-17912] Fix http plugin cannot send json nested types (#17911)
---
.../dolphinscheduler/plugin/alert/http/HttpSender.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java
index 42f1474de4..90280e8020 100644
---
a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java
+++
b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java
@@ -37,12 +37,14 @@ import java.util.Map;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
+import com.fasterxml.jackson.core.type.TypeReference;
+
@Slf4j
public final class HttpSender {
private Map<String, String> headerParams;
private OkHttpRequestHeaderContentType contentType;
- private Map<String, String> bodyParams;
+ private Map<String, Object> bodyParams;
private HttpRequestMethod requestType;
private int timeout;
private String url;
@@ -69,7 +71,8 @@ public final class HttpSender {
String bodyParamsString =
paramsMap.get(HttpAlertConstants.NAME_BODY_PARAMS);
if (StringUtils.isNotBlank(bodyParamsString)) {
- bodyParams = JSONUtils.toMap(bodyParamsString);
+ bodyParams = JSONUtils.parseObject(bodyParamsString, new
TypeReference<Map<String, Object>>() {
+ });
if (bodyParams == null) {
throw new IllegalArgumentException("bodyParams is not a valid
json");
}
@@ -215,8 +218,9 @@ public final class HttpSender {
}
bodyParams.forEach((key, value) -> {
- if (value.contains(HttpAlertConstants.MSG_PARAMS)) {
- bodyParams.put(key,
value.replace(HttpAlertConstants.MSG_PARAMS, msg));
+ String valueOf = String.valueOf(value);
+ if (valueOf.contains(HttpAlertConstants.MSG_PARAMS)) {
+ bodyParams.put(key,
valueOf.replace(HttpAlertConstants.MSG_PARAMS, msg));
}
});
}