Also return result of the evaluation

-Maximum compatibility with @chakflying's existing json-query monitor code.
This commit is contained in:
Matt Visnovsky
2024-06-06 10:09:35 -06:00
parent 10d3188dd3
commit eaa935cba0
4 changed files with 33 additions and 23 deletions

View File

@@ -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;