pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.08k stars 479 forks source link

Provider side validation with Request headers #1247

Open Dattasaisukumar opened 3 years ago

Dattasaisukumar commented 3 years ago

Hi All can anyone please help me in validating Provider with Request headers , please find my below code snippets Pact files and error I am getting while Validating the Provider

image image

Pact File:-

{ "provider": { "name": "GetCitizenProvider" }, "consumer": { "name": "ServiceabilityConsumer" }, "interactions": [ { "description": "Receiving Citizen Get Request", "request": { "method": "GET", "path": "/citizen/1", "headers": { "Language": "en" } }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "body": { "name": "string", "id": 100 }, "matchingRules": { "body": { "$.id": { "matchers": [ { "match": "integer" } ], "combine": "AND" }, "$.name": { "matchers": [ { "match": "type" } ], "combine": "AND" } } }, "generators": { "body": { "$.id": { "type": "RandomInt", "min": 0, "max": 2147483647 }, "$.name": { "type": "RandomString", "size": 20 } } } }, "providerStates": [ { "name": "Request for getting Citizen Data" } ] } ], "metadata": { "pactSpecification": { "version": "3.0.0" }, "pact-jvm": { "version": "4.0.10" } } }

uglyog commented 3 years ago

To verify the provider, you need to have the provider running on the required port (8083). The connection refused error is because it is not running.