mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
Record request mapping outputs JsonMatcher with Patterns instead of Pattern #397
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 @tjpeel on GitHub (Jan 24, 2022).
Originally assigned to: @StefH on GitHub.
Hi,
I collated the following example https://github.com/tjpeel/wiremock-question-jsonmatcher/blob/main/Program.cs#L23-L46
Please run the Program to see the issue.
The issue might be a misconfiguration on my part or be by design, or be a bug, which is why the example was made.
TLDR; when a request is recorded with a request body, the mapping includes a JsonMatcher with a Patterns property, yet when the mapping is used it will never match the request again as the incoming request is checked against an array (Patterns property) instead of each item in the array. Or it should have serialised the recorded request using the Pattern property instead.
Example servers from Program.cs
Many thanks
@StefH commented on GitHub (Jan 24, 2022):
@tjpeel
Thank you for this issue with extended description.
I think I found some issues in the JsonMatcher, this cannot handle
Patterns(yet).For now I'll just change the Save code to output
patterninstead of patterns`.Can you try preview version 1.4.33-ci-15809 ?
https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions
@tjpeel commented on GitHub (Jan 24, 2022):
Thanks, sounds good. I’ll give it a try in the morning but I’m sure all will be good if it defaults to save as Pattern 👍
@StefH commented on GitHub (Jan 27, 2022):
@tjpeel
Did you have time to verify ?
@tjpeel commented on GitHub (Jan 27, 2022):
Please forgive me @StefH I was offline for the past couple of days. I have just checked now and all looks good. Thanks!
@StefH commented on GitHub (Jan 27, 2022):
Hello @tjpeel, thanks for testing.
A new official NuGet version will be released shorty.
https://github.com/WireMock-Net/WireMock.Net/pull/716