Throw exception in case WithTransformer is used after WithBodyFromFile (#1185)

* Fix .WithBodyFromFile + .WithTransformer combination

* Ex
This commit is contained in:
Stef Heyenrath
2024-09-29 21:29:34 +02:00
committed by GitHub
parent edbc7aeb5c
commit 76ae1466cc
7 changed files with 151 additions and 33 deletions

View File

@@ -13,6 +13,8 @@ namespace WireMock.ResponseBuilders;
public partial class Response
{
private bool _bodyFromFileSet;
/// <inheritdoc />
public IResponseBuilder WithBody(Func<IRequestMessage, string> bodyFactory, string? destination = BodyDestinationFormat.SameAsSource, Encoding? encoding = null)
{
@@ -78,6 +80,8 @@ public partial class Response
{
Guard.NotNull(filename);
_bodyFromFileSet = true;
ResponseMessage.BodyData = new BodyData
{
BodyAsFileIsCached = cache,