Bogdan Barliga
06/23/2025, 1:30 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Bogdan Barliga
06/24/2025, 7:13 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
auto provider = Pact("TodoAppCpp", "TodoServiceCpp");
provider
.given("i have a list of projects")
.uponReceiving("a request for projects")
.withRequest("GET", "/projects")
.withQuery(query)
.withHeaders(headers)
.willRespondWith(200)
.withResponseHeaders(res_headers)
.withResponseJsonBody(Object({
{ "someKey", Object({}) }
}));
Bogdan Barliga
06/24/2025, 10:17 AM"someKey": {}
in the contract to the correct place in the interaction response.body
and no matching rules.
I assume then that during verification any payload received for someKey
will be ignored (and the verification will pass), while a missing someKey
will fail the verification.
The thing that I am after is that I would also like to supply a sample payload, so that when we run the consumer test that generates the contract we can also exercise and verify the payload handling.Matt (pactflow.io / pact-js / pact-go)
The thing that I am after is that I would also like to supply a sample payload, so that when we run the consumer test that generates the contract we can also exercise and verify the payload handling. (edited)hmm whatever you put into the payload will then need to be there during verification (unless you post-process the pact file to remove it?)
Bogdan Barliga
06/24/2025, 12:32 PMjson
matcher.
Thanks for your help!