-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using ProviderStateGenerator should not allow mock server to match any request #447
Comments
The interaction has been misconfigured with a type matcher for the path. This is a Pact-JS issue. matching_rules: MatchingRules { rules: {PATH: MatchingRuleCategory { name: PATH, rules: {DocPath { path_tokens: [Root], expr: "$" }: RuleList { rules: [Type], rule_logic: And, cascaded: false }} }} } |
Ah, good spot! So I need to think about how this function should be defined. It's currently both a matcher and a generator - I think it should not be a matcher itself, but potentially could also accept a matcher or expression in the example e.g. matcher
or expression
Which one (if any) is the right approach here? |
Pact-JVJM only sets the generator: https://github.com/search?q=repo%3Apact-foundation%2Fpact-jvm%20pathFromProviderState&type=code |
ok cool, thanks. Is it true that any expression can be used in the second part, or only expressions (of another kind) that contain the dynamically replaceable values? |
I don't know if that is true. It could be. It could also be false. |
Closing, Pact JS issue (introduced in pact-foundation/pact-js@5fdf7eb#diff-884c1c7cbdaafa772a7a428e0ca83ce1fc58f03972dfa0fabcb89106d6ac35f5R409). |
Via: pact-foundation/pact-js#1088
Summary
When I add interaction like this:
I expect mock server should return
404
for this requestGET /any
, but it return200
with body{"id": "14f6626f-c51e-4311-ac52-182c8f2a7634"}
Expected behaviour
The request GET /any should return 404, and mock server should report the request GET /api/users/14f6626f-c51e-4311-ac52-182c8f2a7634 is expected but not received.
Actual behaviour
The request GET /any return 200 with json body that didn't belong to it.
Steps to reproduce
Here is the demo project https://github.com/tienvx/test-from-provider-state-generator
Relevant log files
The text was updated successfully, but these errors were encountered: