Hey guys, we are having a look into stubbing and ...
# pactflow
w
Hey guys, we are having a look into stubbing and found the pact-stub-server that is provided by the pact foundation. The docker image gives the option to provide a header to select provider-states and get an answer based on that. We wondered whether there is an option to use this against the Pactflow instance as well. Do you have a default header that we can set to use the stubbing service of PactFlow to select the response based on a provider state, or is this not possible at all? Kind regards, Werner
m
At the moment this isn't possible. I'll add a note to our backlog. May I ask a bit more about your use case for the wtib server?
How would you know when to set the correct header to select the right interaction?
w
Hey Matt, the pact-stub-server allows to set a header to determine the answer that you would get based on provider state. With that you could always built certain scenarios e.g. for prototyping something. Easiest example I can come up with would be a get endpoint returning 404 (no item), then you put something there and on next request to get endpoint would yield the item. As stated earlier, just wondered whether you have something similar in place for Pactflow. For us this is not an important feature looking at PactFlow, since we can always use the pact-stub-server for local development. Thanks a lot for your answer. Kind regards, Werner
m
oh right, I understand about provider states and the stub server, but was just trying to understand how it would be used. In most cases I’ve seen from people, the stub server is designed for uses in test cases (usually e2e UI type tests - such as Cypress). So to be able to make use of the feature, the API client would need to be told by the test runner to “add this header”. It’s not impossible, but certainly makes writing those kinds of tests more difficult/cumbersome. I think we should support it, or something like it if we continue to invest in the hosted stub feature. A bigger issue at the moment is that it only supports V2 pacts, which is more important to address I think
👍 1
Also, thank you for your discussion on the matter!