WireMock-Net / WireMock.Net

WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on the functionality from http://WireMock.org, but extended with more functionality.
Apache License 2.0
1.36k stars 200 forks source link

How to use brackets '[ ]' in Random String List HandleBar ? #956

Closed pouyaSobhanipour closed 1 year ago

pouyaSobhanipour commented 1 year ago

Hello

i want to use "{{Random Type=\"StringList\" Values=[\"a\", \"b\", \"c\"]}}" to receive a random response from mock server each time i do a request.

instead of a,b or c i want to use the following string : "{\'errors\':[{\'detail\':\'Conditions must be seen\'}]}"

it seems that when we have closed [] or {} wiremock does not responde . how should i by pass this issue ?

Thanks

StefH commented 1 year ago

This is probably possible, however I do not know the answer.

Best is to take a approach where you use a switch statement.

See https://stackoverflow.com/a/53398537/255966

pouyaSobhanipour commented 1 year ago

hello

but i need to use a mock list. the solution you have provided uses completely another approach. isn't there any way to use the Random handle bar to by pass this problem ?

Thanks