From ee90d2713f2d5f415a458bd04f59add32d7e3cb1 Mon Sep 17 00:00:00 2001 From: Jimmy Huang Date: Mon, 24 Jan 2022 13:31:49 +0800 Subject: [PATCH 1/3] refs issue-1201 in upstream. Add 100 characters from response body to bean.msg after keyword not match. --- server/model/monitor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index c4441d63e..1866fdb7c 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -231,7 +231,11 @@ class Monitor extends BeanModel { bean.msg += ", keyword is found"; bean.status = UP; } else { - throw new Error(bean.msg + ", but keyword is not found"); + data = data.replace(/<[^>]*>?|[\n\r]|\s+/gm, " "); + if ( data.length > 50 ) { + data = data.substring(0, 47) + "..."; + } + throw new Error(bean.msg + ", but keyword is not in [ " + data + " ]"); } } From 244a7b367195346a0396180c061dcb6e78c19402 Mon Sep 17 00:00:00 2001 From: Jimmy Huang Date: Mon, 7 Feb 2022 18:46:16 +0800 Subject: [PATCH 2/3] Update server/model/monitor.js Co-authored-by: Adam Stachowicz --- server/model/monitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 1866fdb7c..fc8ad9e58 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -235,7 +235,7 @@ class Monitor extends BeanModel { if ( data.length > 50 ) { data = data.substring(0, 47) + "..."; } - throw new Error(bean.msg + ", but keyword is not in [ " + data + " ]"); + throw new Error(bean.msg + ", but keyword is not in [" + data + "]"); } } From a4be651118da5923675843f0b5f9c02afdf5bbd7 Mon Sep 17 00:00:00 2001 From: Jimmy Huang Date: Fri, 1 Apr 2022 15:26:50 +0800 Subject: [PATCH 3/3] Update server/model/monitor.js Co-authored-by: Adam Stachowicz --- server/model/monitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index fc8ad9e58..ad74cd3db 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -232,7 +232,7 @@ class Monitor extends BeanModel { bean.status = UP; } else { data = data.replace(/<[^>]*>?|[\n\r]|\s+/gm, " "); - if ( data.length > 50 ) { + if (data.length > 50) { data = data.substring(0, 47) + "..."; } throw new Error(bean.msg + ", but keyword is not in [" + data + "]");