WireMock. How to return different statuses in response to one request?

69 Views Asked by At

Is there any way to redesign a query so that it returns a random status: 200 or 400 in the response?

{
    "request": {
        "name": "My mock",
        "urlPath": "/my-resource",
        "method": "POST"
    },
    "response": {
        "status": 200,
        "body": "{{ randomInt lower=10000 upper=9999999}}",
        "delayDistribution": {
            "type": "uniform",
            "lower": 10,
            "upper": 2000
        },
        "headers": {
            "Content-type": "application/json; charset=utf-8"
        }
    }
}

I will always send the same body to this address, so different scenarios and selection depending on parameters is not suitable for me. I need the status code to be returned randomly: 200 or 400.

0

There are 0 best solutions below