Fix for WithTransformer and JsonBody as list (#1315)

* Fix for WithTransformer and JsonBody as list

* Fix WithTransformer when the response BodyAsJson is a List
This commit is contained in:
Stef Heyenrath authored and GitHub committed 2025-06-11 11:51:29 +02:00
1 parent ec248a9a78
commit 77000372c6
2 files changed
+77 -6

No files matched your search

@@ -1,6 +1,7 @@
// Copyright © WireMock.Net
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using HandlebarsDotNet.Helpers.Models;
@@ -170,8 +171,8 @@ internal class Transformer : ITransformer
WalkNode(transformerContext, options, jToken, model);
break;
case Array bodyAsArray:
jToken = JArray.FromObject(bodyAsArray, _jsonSerializer);
case var bodyAsEnumerable when bodyAsEnumerable is IEnumerable and not string:
jToken = JArray.FromObject(bodyAsEnumerable, _jsonSerializer);
WalkNode(transformerContext, options, jToken, model);
break;