mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-03 03:56:18 -04:00
Also return result of the evaluation
-Maximum compatibility with @chakflying's existing json-query monitor code.
This commit is contained in:
parent
10d3188dd3
commit
eaa935cba0
4 changed files with 33 additions and 23 deletions
|
@ -609,13 +609,13 @@ class Monitor extends BeanModel {
|
|||
}
|
||||
}
|
||||
|
||||
const result = await evaluateJsonQuery(data, this.jsonPath, this.jsonPathOperator, this.expectedValue);
|
||||
const { status, evaluation } = await evaluateJsonQuery(data, this.jsonPath, this.jsonPathOperator, this.expectedValue);
|
||||
|
||||
if (result) {
|
||||
if (status) {
|
||||
bean.msg += ", expected value is found";
|
||||
bean.status = UP;
|
||||
} else {
|
||||
throw new Error(`${bean.msg}, but value is not equal to expected value, value was: [${result}]`);
|
||||
throw new Error(`${bean.msg}, but value is not equal to expected value, value was: [${evaluation}]`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue