Hi Everyone, Good day. I would like to use the `{{...
# help
m
Hi Everyone, Good day. I would like to use the
{{#assign 'myCapitalisedQuery'}}{{capitalize request.query.search}}{{/assign}}
variable assignment and reuse in the response template. Can some one give a sample response for this?
t
Looks like you’ve got the right idea there. What’s not working for you currently?
👍 1
m
Sample request: { "persons" : [ {"name": "foo"} ] } Mapping:
.....
*"jsonBody"*: {
"output": {{#assign 'reqName'}}{{jsonPath request.body '$.persons[0].name'}}{{/assign}}{{reqName}},
"personName" : {{reqName}}
}
.....
Output as follows: response -> { "output" : "foo", "personName" : "foo" }
Initially I didn't found right place to put the assignment, @Tom worked well.