Selaa lähdekoodia

fix http alarm msg ignored (#7523)

See https://github.com/apache/dolphinscheduler/issues/7522
Jiezhi.G 3 vuotta sitten
vanhempi
commit
6562bc9145

+ 4 - 4
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());