API Specs:
GET /customer/{{customerId}}
My Target responses:
How do I set that any customerId path param not equal or equal to "1234" will have different outcomes?
Seems such a common scenario but I tried looking in this reference link below but can't find any
You can set up two separate mappings with different priorities, so that WireMock will check for the more specific ID first.
Here's an example where the more specific url has Priority 1, and the less specific url has Priority 2, meaning WireMock checks the more specific url first, and if it does not match, checks the less specific url.
{
"mappings": [
{
"priority": 1,
"request": {
"url": "/customer/1234"
},
"response": {
"status": 404
}
},
{
"priority": 2,
"request": {
"urlPath": "/customer/.*"
},
"response": {
"status": 200,
"bodyFileName": "customer.json"
}
}
]
}