mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-24 15:25:36 -04:00
Apply suggestions from code review
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
5dc4bb64d5
commit
b5a73e5ad7
3 changed files with 21 additions and 19 deletions
|
@ -602,9 +602,12 @@ class Monitor extends BeanModel {
|
|||
|
||||
const { status, response } = await evaluateJsonQuery(data, this.jsonPath, this.jsonPathOperator, this.expectedValue);
|
||||
|
||||
bean.status = status ? UP : DOWN;
|
||||
bean.msg = `JSON query ${status ? "passes" : "does not pass"} `;
|
||||
bean.msg += `comparison: ${response} ${this.jsonPathOperator} ${this.expectedValue}.`;
|
||||
if (status) {
|
||||
bean.status = UP;
|
||||
bean.msg = `JSON query passes (comparing ${response} ${this.jsonPathOperator} ${this.expectedValue})`
|
||||
} else {
|
||||
throw new Error(`JSON query does not pass (comparing ${response} ${this.jsonPathOperator} ${this.expectedValue})`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue