mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
How does WithBody work with request matchers? #573
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 @jonakirke94 on GitHub (Feb 12, 2024).
I'm using the testcontainers wiremock and try to set up a request mapping.
I'm using AdminApiMappingBuilder
This is an example:
How can I use WithBody here with JsonPartialMatcher? WithBody takes a MatcherModelBuilder but it's unclear to me how we can leverage this.
@StefH commented on GitHub (Feb 13, 2024):
@jonakirke94
There a are several Json matchers available, see this wiki page for an overview (https://github.com/WireMock-Net/WireMock.Net/wiki/Request-Matchers) and see the detail page for how to use it.
@jonakirke94 commented on GitHub (Feb 13, 2024):
@StefH The syntax seem different when using the AdminAPI
The examples do not use the AdminApiMappingBuilder
Could you show me how to do it?
@StefH commented on GitHub (Feb 13, 2024):
@jonakirke94
I do understand your question now. In that case, your code should be like:
@jonakirke94 commented on GitHub (Feb 13, 2024):
Thanks.
So in your example it matches a json property "test" with value "abc"
@StefH commented on GitHub (Feb 13, 2024):
correct