For query, see this thread
# libpact_ffi-users
t
For query, see this thread
FFI call:
Copy code
```
pactffi_with_query_parameter_v2($interactionId, 'pages', 0, '{"value":"1","regex":"\\d+","pact:matcher:type":"regex"}');
```
Http client query:
Copy code
?pages=2&pages=3
Trimmed logs about matching rule:
Copy code
2023-10-23T01:46:59.767978Z DEBUG tokio-runtime-worker pact_matching:      matching_rules: MatchingRules { rules: {QUERY: MatchingRuleCategory { name: QUERY, rules: {DocPath { path_tokens: [Root, Field("pages"), Index(0)], expr: "$.pages[0]" }: RuleList { rules: [Regex("\\d+")], rule_logic: And, cascaded: false }} }} }
Logs about mismatches:
Copy code
2023-10-23T01:46:59.768473Z DEBUG tokio-runtime-worker pact_matching: --> Mismatches: [QueryMismatch { parameter: "pages", expected: "", actual: "3", mismatch: "Expected query parameter 'pages' with value '' but was '3'" }, QueryMismatch { parameter: "pages", expected: "[\"1\"]", actual: "[\"2\", \"3\"]", mismatch: "Expected query parameter 'pages' with 1 value(s) but received 2 value(s)" }]
Note: I expect every values of
pages
are integer, not the first value. But I think there are no way to make
pactffi_with_query_parameter_v2
ignore the index
0
,just like how
pactffi_with_header_v2
did:
NOTE: If you pass in a form with multiple values, the index will be ignored.
r
This is the problem
expr: "$.pages[0]"
, there is no way with the FFI params to specify
*
instead of 0
t
How about updating
pactffi_with_query_parameter_v2
to allow something like this (change value from string to array):
Copy code
pactffi_with_query_parameter_v2($interactionId, 'pages', 0, '{"value":["1", "2", ["3"]],"regex":"\\d+","pact:matcher:type":"regex"}');
then it ignore the index
0
r
Can you raise a ticket for it?
t
sure
r
Thank you!