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.09k stars 480 forks source link

Does matchPath(regexPath, examplePath) makes the mock server expect request with examplePath (exact match)? #1767

Open metteo opened 9 months ago

metteo commented 9 months ago

I'm asking because I observed a behavior where modifying the regex to be incompatible with the example didn't fail the test / didn't prevent the matching.

After reading the implementation of the method it seems to me MockServer uses the exact matching with the example path and the regex is just an addition into the pact and as a source of the example if not provided (using Generex).

Would it make sense to validate that the example provided explicitly matches the regex to prevent such situations?

github-actions[bot] commented 9 months ago

🤖 Great news! We've labeled this issue as smartbear-supported and created a tracking ticket in PactFlow's Jira (PACT-1827). We'll keep work public and post updates here. Meanwhile, feel free to check out our docs. Thanks for your patience!