You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pact go library should allow to exactly match multiple occurrences of the same query parameter as it is supported within pact files and by libraries for other platforms as shown e.g. here.
Actual behaviour
The Pact go library doesn't support matching multiple values of the same query parameter precisely.
Steps to reproduce
pact.
AddInteraction().
Given("Some state").
UponReceiving("A request with multiple occurrences of a query parameter").
WithRequest(dsl.Request{
Method: "GET",
Path: dsl.String("/api/v1/resource"),
Query: dsl.MapMatcher{
"myparam": dsl.Like([]string{"value1", "value2"}),
},
}).
...
Unfortunately this doesn't work because the query parameter values are treated as a nested slice resulting in this diff within the consumer test log:
However the Pact Go DSL doesn't allow me to do so since it requires me to provide a Matcher for the value but there is no matcher to precisely match an array. Supporting such a matcher could be a solution to this problem.
Workaround
A workaround is to match the query parameter values in a less precise way using dsl.EachLike:
Software versions
Expected behaviour
The pact go library should allow to exactly match multiple occurrences of the same query parameter as it is supported within pact files and by libraries for other platforms as shown e.g. here.
Actual behaviour
The Pact go library doesn't support matching multiple values of the same query parameter precisely.
Steps to reproduce
Unfortunately this doesn't work because the query parameter values are treated as a nested slice resulting in this diff within the consumer test log:
Actually I'd like to specify the parameters like this:
However the Pact Go DSL doesn't allow me to do so since it requires me to provide a
Matcher
for the value but there is no matcher to precisely match an array. Supporting such a matcher could be a solution to this problem.Workaround
A workaround is to match the query parameter values in a less precise way using
dsl.EachLike
:The text was updated successfully, but these errors were encountered: