https://linen.dev logo
#help
Title
m

Mani Kasi

07/25/2023, 4:46 PM
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

Tom

07/25/2023, 6:14 PM
Looks like you’ve got the right idea there. What’s not working for you currently?
👍 1
m

Mani Kasi

07/27/2023, 4:42 PM
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.