Hey community, thanks in advance for the support! ...
# general
d
Hey community, thanks in advance for the support! Let’s assume a consumer application triggers a post call to a provider. Within the request of that call comes a request body in a json format. I wonder if the consumer should structure that request body with matchers just like he does with response body, or should he put a json-object for any reason? My suggestion is to use matcher for request body just like with the response body, but I’m not what’s best practice here. Thanks!
m
Usually you wouldn't, because the matchers on the request are only used in the consumer test
2
And hopefully it's a unit test, so you should be able to control the conditions and this be very specific
In some cases it's warranted but as a general rule I'd avoid it
The matchers aren't used outside of that scope so there's no additional benefits of them being there
d
Thank you very much.
👍 1
t
Matt is completely correct. I'd add - the point of the matchers is just to relax the reliance on exact test data when verifying the provider. If you use any matchers at all, you are saying "I believe this test covers all messages that pass the matchers for this example"