From a9d19ae06ad5bec0b2a90ebf4ba729987cec7118 Mon Sep 17 00:00:00 2001 From: LouisLam Date: Mon, 12 Jul 2021 10:52:41 +0800 Subject: [PATCH] support json for keyword type --- server/model/monitor.js | 9 ++++++++- src/pages/EditMonitor.vue | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index b8e8eb30c..162772875 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -81,7 +81,14 @@ class Monitor extends BeanModel { bean.status = 1; } else { - if (res.data.includes(this.keyword)) { + let data = res.data; + + // Convert to string for object/array + if (typeof data !== "string") { + data = JSON.stringify(data) + } + + if (data.includes(this.keyword)) { bean.msg += ", keyword is found" bean.status = 1; } else { diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 7054d73ac..01af50610 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -30,7 +30,7 @@
-
Search keyword in plain html response and it is case-sensitive
+
Search keyword in plain html or JSON response and it is case-sensitive