Nesting expressions in Wiremock

598 Views Asked by At

I am trying to nest expressions in Wiremock and I get an error. Is it possible to nest a randomValue inside the pickRandom helper?

Example:

I have a wiremock stub that returns: "{{{pickRandom '{\"test\": \"1\"}' '{\"test\": \"{{randomValue type=\'UUID\'}}\"}'}}}"

1

There are 1 best solutions below

0
wp78de On

I cannot test this but it might be possible to select the pickRandom Helper value from a list passed as a parameter, e.g.: {{{pickRandom (jsonPath request.body '$.names')}}}

{{{pickRandom ('{\"test\": \"1\"}' '{\"test\": \"{{randomValue type=\'UUID\'}}\"}')}}}

Ref: http://wiremock.org/docs/response-templating/