From c13dc6354b1e0ceb06afd70db0c41a63380a9965 Mon Sep 17 00:00:00 2001 From: nopast <490964186@qq.com> Date: Fri, 12 May 2023 13:29:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3webhook=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=A4=B4=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/api/func.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/api/func.js b/docker/api/func.js index 60b54b5..0292a29 100755 --- a/docker/api/func.js +++ b/docker/api/func.js @@ -191,9 +191,13 @@ exports.do_webhook = async( id, url, value, html, link, data ) => const json = JSON.stringify( { id, url, value, html, link, data } ); try { + const isJSON = (process.env.WEBHOOK_FORMAT && process.env.WEBHOOK_FORMAT.toLowerCase() == 'json') const response = await fetch( process.env.WEBHOOK_URL , { method: 'POST', - body: (process.env.WEBHOOK_FORMAT && process.env.WEBHOOK_FORMAT.toLowerCase() == 'json') ? json : form + headers: { + 'Content-Type': isJSON? 'application/json' : 'application/x-www-form-urlencoded' + }, + body: isJSON ? json : form } ); const ret = await response.text(); -- Gitee