mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Response body is missing in generated pact file when IBodyResponseBuilder.WithBody is used #433
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @shack05 on GitHub (Aug 10, 2022).
Describe the bug
If I use the
IBodyResponseBuilder.WithBodymethod to specify a response based on a string and then generate a pact file then the pact file will not include the response body.If I use
WithBodyAsJsonthe response body is defined as expected in the pact file.Expected behavior:
The response body is defined in the pact file.
Test to reproduce
Expected pact:
Actual pact:
The resulting pact file is:
Other related info
Wiremock version 1.5.3
The reason I am using
WithBodyrather thanWithBodyAsJsonis because, as far as I am aware, the json I am trying to describe cannot be declared as an anonymous object because some json property names start with a dollar sign and some property names include colons. Is there an alternative to usingWithBodysuch as being able to configure a json serializer to be used in theWithBodyAsJsonmethod?@StefH commented on GitHub (Aug 10, 2022):
Hello @shack05
I'll take a look at the code.
For this question:
--> This looks a bit like this one? https://github.com/WireMock-Net/WireMock.Net/issues/774
@StefH commented on GitHub (Aug 10, 2022):
@shack05
Can you try preview version
1.5.3-ci-16331from MyGet?https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions
@shack05 commented on GitHub (Aug 11, 2022):
Hi,
Thanks for the quick response.
@StefH commented on GitHub (Aug 11, 2022):
@shack05
Can you open a new issue for this:
I'll merge the PR. For now just keep using the preview version, in some time a new official version will be released.