test: Add case for making sure pat() works inside a JSON array
@@ -309,6 +309,13 @@ func TestCondition_evaluate(t *testing.T) {
ExpectedSuccess: false,
ExpectedOutput: "pat(*<div id=\"user\">john.doe</div>*) == [BODY] (<!DOCTYPE html><html lang...(truncated))",
},
+ {
+ Name: "body-pattern-in-array",
+ Condition: Condition("[BODY].data == pat(*Whatever*)"),
+ Result: &Result{body: []byte("{\"data\": [\"hello\", \"world\", \"Whatever\"]}")},
+ ExpectedSuccess: true,
+ ExpectedOutput: "[BODY].data == pat(*Whatever*)",
+ },
{
Name: "ip-pattern",
Condition: Condition("[IP] == pat(10.*)"),
