Alex Makdessi
08/04/2022, 1:08 PM--provider-states-setup-url
option. However, on the endpoint I configured, I'm receiving a null
state
This is what my endpoint is receiving:
{
"body": {
"consumer": "ms.pact-consumer-example-for-php",
"state": null,
"states": [
null
],
"params": []
}
}
Alex Makdessi
08/04/2022, 1:12 PM{
"consumer": {
"name": "ms.pact-consumer-example-for-php"
},
"provider": {
"name": "ms.pact-provider-example-for-php"
},
"interactions": [
{
"description": "A request for a product",
"providerState": "A produƒct with id c931b702-f48a-447c-8619-80556f40e82b exists",
"request": {
"method": "GET",
"path": "/api/v1/products/c931b702-f48a-447c-8619-80556f40e82b",
"headers": {
"Content-Type": "application/json"
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": {
"id": "c931b702-f48a-447c-8619-80556f40e82b",
"name": "Drill",
"brand": "Makita"
},
"matchingRules": {
"$.body.id": {
"match": "regex",
"regex": "^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$"
},
"$.body.name": {
"match": "type"
},
"$.body.brand": {
"match": "type"
}
}
}
},
{
"description": "A request for a product",
"providerState": "There is no product with id 9b40cb15-dfcf-496f-9ba2-208312a25527",
"request": {
"method": "GET",
"path": "/api/v1/products/9b40cb15-dfcf-496f-9ba2-208312a25527",
"headers": {
"Content-Type": "application/json"
}
},
"response": {
"status": 404,
"headers": {
"Content-Type": "application/json"
},
"body": {
"error": {
"message": "The product with id \"9b40cb15-dfcf-496f-9ba2-208312a25527\" does not exists",
"app_code": "PRODUCT_NOT_FOUND"
}
},
"matchingRules": {
"$.body.error.message": {
"match": "type"
},
"$.body.error.app_code": {
"match": "type"
}
}
}
}
],
"metadata": {
"pactSpecification": {
"version": "3.0.0"
}
}
}
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
providerStates
with a v2 pact spec and see if that resolves it, and if so I would assume there is some work in PHP, if not it will be something else 👍Alex Makdessi
08/04/2022, 1:39 PM2.0.0
on the consumer side, and now i'm receiving this body in my setup endpoint
{
"body": {
"consumer": "ms.pact-consumer-example-for-php",
"state": "A product with id c931b702-f48a-447c-8619-80556f40e82b exists",
"states": [
"A product with id c931b702-f48a-447c-8619-80556f40e82b exists"
],
"params": []
}
}
I assume that I should use the state
key instead of the states
one ?Yousaf Nabi (pactflow.io)
state
👍
Ignore theGood luck in your pact Journey buddy!array that you will see if you happen to print out the live provider state set up request bodystates