mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-02-05 00:28:30 -06:00
Convert result to string
This commit is contained in:
@@ -167,7 +167,7 @@ class NetworkService {
|
||||
|
||||
if (contentType && contentType.includes('application/json')) {
|
||||
try {
|
||||
result = jmespath.search(result, jsonPath).toString();
|
||||
result = jmespath.search(result, jsonPath);
|
||||
} catch (error) {
|
||||
httpResponse.status = false;
|
||||
httpResponse.message = "JSONPath Search Error";
|
||||
@@ -180,13 +180,14 @@ class NetworkService {
|
||||
}
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
if (result === null || result === undefined) {
|
||||
httpResponse.status = false;
|
||||
httpResponse.message = "Empty Result";
|
||||
return httpResponse;
|
||||
}
|
||||
|
||||
let match;
|
||||
result = result.toString();
|
||||
if (matchMethod === "include") match = result.includes(expectedValue);
|
||||
else if (matchMethod === "regex") match = new RegExp(expectedValue).test(result);
|
||||
else match = result === expectedValue;
|
||||
|
||||
Reference in New Issue
Block a user