I have the below wiremock setup & trying to set up the urlPattern matching using regex.
{
"scenarioName": "CPM Get Entitlements:Error - CPM_10000 - DOWNSTREAM_ERROR - Status 500",
"request": {
"method": "GET",
"urlPattern": "<REGEX>"
},
"response": {
"status": 500,
"body": "{\"code\": \"CPM_10000\",\"description\": \"some description\"}"
}
}
My URLs could be any one of these two.
- http://localhost:8091/household/7c4c5cb4-ed2e-4fde-a774-66294698c035/entitlements
- http://localhost:8091/household/7c4c5cb4-ed2e-4fde-a774-66294698c035/entitlements?includeFutureDated=true
I have tried various REGEX patterns like the one below but non of them works for 2nd URL with query param. I am able to construct REGEX that works in the text editor or in java but it seems not to be working in wiremock config file.
REGEX
- /household/.+/entitlements(.*)
- /household/.+/entitlements(\?includeFutureDated=true)
- /household/.+/entitlements(?includeFutureDated=true)
Is there a way to fix this in wiremock?
I find it easier to match on
urlPathPatterninstead ofurlPatternin this case, and then have a separatequeryParametersmatcher.