From d9d234551a466d44eee6afcdaf974e1d52cb729a Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Fri, 29 Dec 2023 21:14:36 +0800 Subject: [PATCH] fix: fix http header json validator problem --- .../components/monitor/provider/http.tsx | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/client/components/monitor/provider/http.tsx b/src/client/components/monitor/provider/http.tsx index 1455ccb..bdf5810 100644 --- a/src/client/components/monitor/provider/http.tsx +++ b/src/client/components/monitor/provider/http.tsx @@ -75,6 +75,10 @@ const MonitorHttp: React.FC = React.memo(() => { rules={[ { validator(rule, value, callback) { + if (!value) { + callback(); + } + try { const obj = JSON.parse(value); if (typeof obj !== 'object') { @@ -94,7 +98,30 @@ const MonitorHttp: React.FC = React.memo(() => { placeholder='For example: { "key": "value" }' /> - +