pact-mock_service icon indicating copy to clipboard operation
pact-mock_service copied to clipboard

Feature request - Response based on provider state

Open foliv57 opened this issue 3 years ago • 1 comments
trafficstars

Hi,

For now, if there is multiple matching interactions, the mock service return only one response.

From doc: Where multiple matching interactions are found, the interactions will be sorted by response status, and the first one will be returned. This may lead to some non-deterministic behaviour.

To stay in line with the Pact philosophy and pact description, why not just introducing a custom HTTP header "X-Provider-State" to let the consumer set the expected provider state.

Like this, the mock service can know the response to produce based on the pact.

Regards

Thank you

foliv57 avatar Feb 08 '22 13:02 foliv57

:+1: on this! Although what I gather from how https://github.com/pact-foundation/pact-provider-verifier behaves, the provider state will be communicated via an explicit POST request before the interaction step.

iku000888 avatar Jun 06 '23 23:06 iku000888