<Wiremock random response with different status co...
# stackoverflow
r
Wiremock random response with different status code to the same request I'm using wiremock, I have several responses for the same path and method, get /one. I would like to respond with different status code randomly. I know I can differ the response sequentially using scenarios, but not randomly. I'm talking about doing it directly in json configuration, not using JAVA wiremock API. For example, I would know how to respond the sequence [200,400,401,200,400,401...etc] but not a random one like [400, 200, 401, 200, 400, 400..etc]
a
This one isn’t possible using
randomInt
or
pickRandom
, right? Because those helpers need to be in a string and the
status
field won’t accept the string?
l
Correct. Also, I could be wrong but I don't think response templating is available for the status field
a
So their best bet is to use a ResponseTransformer?
l
Yeah, they could do this if they built their own extension. Other than that I think scenarios is their best bet even though it doesn't give them exactly what they need
👍🏻 1
Just checking, did you want to reply to the stack overflow question or would you prefer me to?
a
Ah sorry - I had forgot to respond, but if you’re already in the headspace, it’d be helpful (project stress 😞 )
l
No problem