The or
predicate matches if any of its sub-predicates match.
POST /imposters HTTP/1.1
Host: localhost:<%= port %>
Accept: application/json
Content-Type: application/json
{
"port": 4553,
"protocol": "tcp",
"mode": "text",
"stubs": [
{
"responses": [{ "is": { "data": "matches" } }],
"predicates": [
{
"or": [
{ "startsWith": { "data": "start" } },
{ "endsWith": { "data": "end\n" } },
{ "contains": { "data": "middle" } }
]
}
]
}
]
}
The stub matches if the first sub-predicate matches:
echo 'start data transmission' | nc localhost 4553
matches
The stub matches if the second sub-predicate matches:
echo 'data transmission end' | nc localhost 4553
matches
The stub matches if the last sub-predicate matches:
echo 'data middle transmission' | nc localhost 4553
matches
The stub does not match none of the sub-predicates match...
echo 'data transmission' | nc localhost 4553
...which yields an empty response:
DELETE /imposters/4553 HTTP/1.1
Host: localhost:<%= port %>
Accept: application/json