Useful helper functions
Concatenate two strings
Search and replace text in a string
Create an array from a delimited string
This can be particularly useful when dealing with the results of a JsonPath query that returns an array, as these are space delimited strings of values.
Change the HTTP response code
If you are following a pattern where you want a single request/response pair to return different HTTP response codes based on the outcome of logic, then you can do that using the following function:
12. Avoiding HTML encoding in function return values
By default the handlebars engine will HTML escape every value it returns into the template.
What this means is that if the value returned from any function contains one of the HTML special characters, then they will be replaced with their escaped equivalent.
In order to avoid this behavior, you need to enclose the function in triple handlebar syntax.
for example:
might return
where as, if used with triple handlebars:
might return
Last updated