diff --git a/Response-Templating.md b/Response-Templating.md index b25af31..669d8f0 100644 --- a/Response-Templating.md +++ b/Response-Templating.md @@ -130,10 +130,10 @@ In addition to the standard helpers, also the helpers from [Handlebars.Net.Helpe The following extra helpers are present in WireMock.Net: - [Humanizer](https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/Humanizer) - [JsonPath.SelectToken & JsonPath.SelectTokens](#jsonpath) -- Linq +- [Linq](https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/DynamicLinq) - [Random](#random) - Regex.Match -- [XPath.SelectSingleNode & XPath.SelectNodes & XPath.Evaluate](#xpath) +- [XPath.SelectSingleNode & XPath.SelectNodes & XPath.Evaluate](#xpath) and [XPath](https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/XPath) - Xeger ## JsonPath @@ -156,6 +156,17 @@ server ); ``` +:warning: +When returning a more complex Json Body like this: +``` json +{ + "market": "{{JsonPath.SelectToken request.bodyAsJson '$.pricingContext.market'}}", + "languages": "en" +} +``` + +You need to to use single quote (`'`) instead of escaped double quotes (`\"`) because of some parsing error @ Handlebars.Net (see also #1108). + Or using the admin mapping file: ``` js { @@ -211,6 +222,8 @@ Note that also replacing values in a Json Object and returning a the body as Jso } ``` +--- + ## Random It's possible to return random data using the `Random` Handlebars function. @@ -265,6 +278,8 @@ Besides a random text string, it's also possible to generate this random data: Note: instead of using `\"` in above examples, you can also use `'`. +--- + ## XPath XPath support is also present @@ -313,5 +328,3 @@ Or using the admin mapping file: ``` For examples on `XPath.SelectNodes` and `XPath.Evaluate`, see https://github.com/WireMock-Net/WireMock.Net/blob/master/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsXPathTests.cs - -### \ No newline at end of file