From 6562bc914597ec9b8233330a76137c9fc26b5986 Mon Sep 17 00:00:00 2001 From: "Jiezhi.G" Date: Tue, 21 Dec 2021 16:04:12 +0800 Subject: [PATCH] fix http alarm msg ignored (#7523) See https://github.com/apache/dolphinscheduler/issues/7522 --- .../dolphinscheduler/plugin/alert/http/HttpSender.java | 8 ++++---- 1 file changed, 4 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 923fe55b33..add0e7c6ac 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 @@ -143,11 +143,11 @@ public final class HttpSender { * set body params */ private void setMsgInRequestBody(String msg) { - ObjectNode objectNode = JSONUtils.parseObject(bodyParams); - //set msg content field - objectNode.put(contentField, msg); try { - StringEntity entity = new StringEntity(bodyParams, DEFAULT_CHARSET); + ObjectNode objectNode = JSONUtils.parseObject(bodyParams); + //set msg content field + objectNode.put(contentField, msg); + StringEntity entity = new StringEntity(JSONUtils.toJsonString(objectNode), DEFAULT_CHARSET); ((HttpPost) httpRequest).setEntity(entity); } catch (Exception e) { logger.error("send http alert msg exception : {}", e.getMessage());