mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-21 00:50:24 +01:00
Updated Response Templating (markdown)
@@ -5,6 +5,25 @@ Response headers and bodies can optionally be rendered (templated) with:
|
||||
|
||||
This enables attributes of the request to be used in generating the response e.g. to pass the value of a request ID header as a response header or render an identifier from part of the URL in the response body. To use this functionality, add `.WithTransformer()` to the response builder.
|
||||
|
||||
## Way-Of-Working
|
||||
## 1. Define "Handlebars template"
|
||||
``` handlebars
|
||||
Hello {{firstname}}
|
||||
```
|
||||
|
||||
## 2. Data
|
||||
``` c#
|
||||
var user = new
|
||||
{
|
||||
firstname = "Stef"
|
||||
}
|
||||
```
|
||||
|
||||
## 3. Result
|
||||
``` c#
|
||||
Hello Stef
|
||||
```
|
||||
|
||||
### C# Example for using Handlebars.Net :
|
||||
```csharp
|
||||
var server = WireMockServer.Start();
|
||||
|
||||
Reference in New Issue
Block a user