Hi! I am trying to use the form data of a request ...
# wiremock-java
a
Hi! I am trying to use the form data of a request in the response. The request body looks like this
Copy code
flag1[enabled]=true&transfer[destination]=target_account&metadata[userId]=1-2-3-4&metadata[sessionId]=a-b-c
I am having a hard time to use the values in the response. I am parsing the form via
Copy code
{{formData request.body 'params' urlDecode=true}}
and I can see the values fine when doing
Copy code
{{#each params}}
{{@index}} - {{@key}} - {{this}}
{{/each}}
But I cannot access the individual fields, no matter what I try, e.g.,
Copy code
{{"metadata[userId]"}}
{{metadata\[userId\]}}
{{metadata.userId}}
My Google-fu also failed me 😕
Not sure how applicable it is, but it does work on http://tryhandlebarsjs.com/
t
Hi @Alex P, square brackets seem to be an issue for this implementation of Handlebars, but there’s a solution which is to use the
lookup
helper e.g.
Copy code
{{lookup params 'transfer[destination]'}}
🙌 1
a
I thought I tried that as well but it seems I needed to sleep over this. This works! Thanks a lot!
👍 1