mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-21 07:37:38 +08:00
Helpful error when query returns object or array
This commit is contained in:
@@ -407,6 +407,9 @@ async function evaluateJsonQuery(data, jsonPath, jsonPathOperator, expectedValue
|
||||
}
|
||||
try {
|
||||
response = (jsonPath) ? await jsonata(jsonPath).evaluate(response) : response;
|
||||
if (typeof response === "object" || Array.isArray(response) || response instanceof Date || typeof response === "function") {
|
||||
throw new Error(`The post-JSON query evaluated response from the server is of type ${typeof response}, which cannot be directly compared to the expected value`);
|
||||
}
|
||||
let jsonQueryExpression;
|
||||
switch (jsonPathOperator) {
|
||||
case ">":
|
||||
|
Reference in New Issue
Block a user