mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-21 07:37:38 +08:00
Also return result of the evaluation
-Maximum compatibility with @chakflying's existing json-query monitor code.
This commit is contained in:
@@ -440,9 +440,12 @@ async function evaluateJsonQuery(data, jsonPath, jsonPathOperator, expectedValue
|
||||
if (evaluation === undefined) {
|
||||
throw new Error("Query evaluation returned undefined. Check your query syntax and the structure of the response data.");
|
||||
}
|
||||
const result = (jsonPathOperator === "custom")
|
||||
const status = (jsonPathOperator === "custom")
|
||||
? evaluation.toString() === expected.toString()
|
||||
: evaluation;
|
||||
return result;
|
||||
return {
|
||||
status,
|
||||
evaluation
|
||||
};
|
||||
}
|
||||
exports.evaluateJsonQuery = evaluateJsonQuery;
|
||||
|
Reference in New Issue
Block a user