Reputation: 3948
The default behavior for a Pact test is to not fail when the provider adds fields to a message that the contract of the consumer does not specify, eg:
Consumer expects:
{
"foo": "bar"
}
Provider provides:
{
"foo": "bar",
"hello": "world"
}
A Pact contract-test using the above noted messages would succeed. Is there a way to make them fail? Some "strict"-mode for example that requires exact matches of messages?
Upvotes: 0
Views: 579
Reputation: 3188
No, that's not possible according to the pact docs:
You cannot expect a field to not be present in a response
Following Postel's law, the provider may return fields that the consumer will just ignore. The provider may have a pact with another consumer that requires those fields, so your consumer cannot tell the provider what it should not do. It can only specify what it should do.
Upvotes: 2