Wiremock standalone set/set null value in response template

352 views
Skip to first unread message

Razvan Cîmpean

unread,
Oct 12, 2022, 9:27:27 AM10/12/22
to wiremock-user
Hi, 
How can I get the null or numeric value of a field from my request and use it in the response? 
So far using transformers I can only get the string value of null(empty string) or of a numeric value (ex: "123" instead of 123) - see attached imgs for more info.
Thanks.
mapping file:
      Screenshot 2022-10-12 at 16.09.15.png

request payload:
Screenshot 2022-10-12 at 16.16.28.png

Expected response:
expected.png

Actual response:

actual.png

Tom Akehurst

unread,
Oct 13, 2022, 8:33:43 AM10/13/22
to wiremock-user
I think the problem here is that you're passing requestBody to the jsonPath helper, whereas it needs to be request.body:

{{jsonPath request.body '$.variables.configuration'}}

Reply all
Reply to author
Forward
0 new messages