mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-21 08:59:50 +01:00
Updated Response Templating (markdown)
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user