https://pact.io logo
#documentation
Title
# documentation
é

Édouard Lopez

06/09/2022, 2:09 PM
Do you have some example or guideline on how to handle a
DELETE
request from both consumer and provider side?
y

Yousaf Nabi (pactflow.io)

06/09/2022, 2:16 PM
Looking across the pact-foundation, there is an example in this project https://github.com/pactflow/example-siren/blob/24fabae041bb454c9c75726ea7cae5cec4b7632c/consumer/src/__tests__/delete-order.spec.js#L95-L102 https://github.com/pactflow/example-siren We recently had a contributor reboot the example and add a couple of others, current WIP https://github.com/pactflow/example-siren/pull/1 might be worth a quick 👀
é

Édouard Lopez

06/09/2022, 2:28 PM
There is nothing in the provider, we want to test the
DELETE
request in an idempotent way, so me need a way to provide the resource id from the consumer or send it back from the provider
y

Yousaf Nabi (pactflow.io)

06/09/2022, 3:06 PM
can you provide a quick sample of the endpoint you are trying to hit? or what you have tried so far, and I can have a nose. just had a look at the project in more detail and there is no provider test code, another one for the list!
m

Matt (pactflow.io / pact-js / pact-go)

06/09/2022, 11:00 PM
Do you have some example or guideline on how to handle a
DELETE
request from both consumer and provider side?
why is this any different to to other requests? You would just have a state that says something like “A user with ID 1234” exists for the delete use case, and the provider would ensure that such a user exists before the tests run
1
☝️ 1
é

Édouard Lopez

06/10/2022, 9:35 AM
Am I correct to assume the mock consumer send the request during the
Execute Provider Test
step from the Lifecycle of a provider verification diagram?
m

Matt (pactflow.io / pact-js / pact-go)

06/10/2022, 9:45 AM
Yep!
1