From 388c2a693bd7c9873c740a411e004181602c8c76 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Tue, 21 May 2024 07:32:22 +0200 Subject: [PATCH] Updated Response Templating (markdown) --- Response-Templating.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Response-Templating.md b/Response-Templating.md index 8287d37..b25af31 100644 --- a/Response-Templating.md +++ b/Response-Templating.md @@ -59,13 +59,11 @@ server "Headers": { "Content-Type": "application/xml" }, "BodyAsFile": "c:\\temp-wiremock\\__admin\\mappings\\_{{request.query.MyUniqueNumber}}_\\MyXmlResponse.xml", "UseTransformer": true, - "UseTransformerForBodyAsFile": true + "UseTransformerForBodyAsFile": true // ⭐ } } ``` -:memo: Note that the `UseTransformerForBodyAsFile` is required to not just transform the filename itself, but also transform the content from that specified file. ([#386](https://github.com/WireMock-Net/WireMock.Net/issues/386) and [#1106](https://github.com/WireMock-Net/WireMock.Net/issues/1106)) - ### Scriban For using Scriban as templating engine, just provide the type: #### C# @@ -117,8 +115,10 @@ The model of the request is supplied to the header and body templates. The follo * `request.bodyAsJson` - Request body as dynamic Json Object. Note that the request **must** contain the header `Content-Type` with value `application/json`! ## Transform the content from a referenced file +:memo: By default, only the response (headers, statuscode, body) are transformed when the `.WithTransformer()` or `UseTransformer` are defined. -In case you also want to transform the contents from a referenced file (via `BodyAsFile`), an additional parameter need to added. Like `.WithTransformer(bool)` or `UseTransformerForBodyAsFile = true`. + +⭐ In case you also want to transform the contents from a referenced file (via `BodyAsFile`), an additional parameter need to added. Like `.WithTransformer(bool)` or `UseTransformerForBodyAsFile = true`. ([#386](https://github.com/WireMock-Net/WireMock.Net/issues/386) and [#1106](https://github.com/WireMock-Net/WireMock.Net/issues/1106)) # Standard Handlebars helpers All of the standard helpers (template functions) provided by the [C# Handlebars implementation](https://github.com/rexm/Handlebars.Net) are available.