I'm trying to randomize the status
returned by a Wiremock (version 2.33.2) endpoint.
Ideally, my configuration would be something like this:
{
"mappings": [
{
"request": {
"method": "PATCH",
"urlPattern": "/giglio/random/supplier-stock/.*",
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
}
},
"response": {
"status": {{pickRandom 200 500}}
}
}
]
}
but of course this is not a valid JSON so I get an error when trying to start Wiremock (Error loading file...
).
If I wrap the offending line:
...
"response": {
"status": "{{pickRandom 200 500}}"
}
...
then Wiremock complains that it Cannot deserialize value of type 'int' from String "{{pickRandom 200 500}}": not a valid 'int' value
.
Is there a way to make this work?