BodyAsJsonIndented (#113)

This commit is contained in:
Stef Heyenrath
2018-03-28 09:51:01 +02:00
parent bdb79aec95
commit df4a1f628a
10 changed files with 107 additions and 40 deletions

View File

@@ -21,7 +21,8 @@ namespace WireMock.Transformers
var template = new { request = requestMessage };
// Body
string body = bodyIsJson ? JsonConvert.SerializeObject(original.BodyAsJson) : original.Body;
Formatting formatting = original.BodyAsJsonIndented == true ? Formatting.Indented : Formatting.None;
string body = bodyIsJson ? JsonConvert.SerializeObject(original.BodyAsJson, formatting) : original.Body;
if (body != null)
{
var templateBody = Handlebars.Compile(body);