Browse Source

changed 改变网络泵解析方式

18339543638 3 years ago
parent
commit
14f081fa8d

+ 2 - 2
jetlinks-components/notify-component/notify-webhook/src/main/java/org/jetlinks/community/notify/webhook/WebHookNotifier.java

@@ -3,6 +3,7 @@ package org.jetlinks.community.notify.webhook;
 import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpResponse;
 import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONUtil;
 import lombok.Getter;
 import lombok.extern.slf4j.Slf4j;
 import org.hswebframework.web.exception.BusinessException;
@@ -93,7 +94,7 @@ public class WebHookNotifier extends AbstractNotifier<WebHookTemplate> {
                             break;
                         case "post":
                             request=HttpUtil.createPost(template.getUrl());
-                            request.body(context.getAllValues().toString());
+                            request.body(JSONUtil.toJsonStr(context.getAllValues()));
                             break;
                         default:break;
                     }
@@ -101,7 +102,6 @@ public class WebHookNotifier extends AbstractNotifier<WebHookTemplate> {
                     request.setConnectionTimeout(Long.valueOf(TimeUnit.SECONDS.toMillis(template.getConnectionTimeout())).intValue());
                     HttpResponse response = request.execute();
                     if (200!=response.getStatus()) {
-//                        return Mono.error(new BusinessException(response.body(), response.getStatus()));
                         return Mono.error(new BusinessException(response.body()));
                     }
                 }catch (Exception e){