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
2025-06-11 11:51:29 +02:00
committed by GitHub
parent ec248a9a78
commit 77000372c6
2 changed files with 77 additions and 6 deletions

View File

@@ -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;