Verify request with duplicate query params
See original GitHub issueI’m really enjoying using wiremock (2.0.10-beta) and have hit a problem trying to verify a call with duplicate query parameters:
/authz/access/12345?operations=op1&operations=op2
My naive attempt didn’t work:
wiremock.verify(getRequestedFor(urlPathEqualTo("/authz/access/12345"))
.withQueryParam("operations", equalTo("op1"))
.withQueryParam("operations", equalTo("op2"))
.withHeader("Authorization", equalTo("Bearer goodtoken")));
The wiremock logs show that the second withQueryParam
is overwriting the first one.
com.github.tomakehurst.wiremock.client.VerificationException: Expected at least one request matching: {
"urlPath" : "/authz/access/12345",
"method" : "GET",
"headers" : {
"Authorization" : {
"equalTo" : "Bearer goodtoken"
}
},
"queryParameters" : {
"operations" : {
"equalTo" : "op2"
}
}
}
Is this a type of verification that Wiremock would consider supporting?
In the meantime, I’m just using the following workaround (and hoping for consistent ordering):
wiremock.verify(getRequestedFor(urlEqualTo("/authz/access/12345?operations=op1&operations=op2"))
.withHeader("Authorization", equalTo("Bearer goodtoken")));
Issue Analytics
- State:
- Created 7 years ago
- Reactions:15
- Comments:24
Top Results From Across the Web
Verify request with duplicate query params · Issue #398 - GitHub
Here's one way you can do this with hamcrest matchers to verify ( contains ) or ignore ( containsInAnyOrder ) the order of...
Read more >Authoritative position of duplicate HTTP GET query keys
Typical approaches include: first-given, last-given, array-of-all, string-join-with-comma-of-all. Suppose the raw request is: GET /blog/posts?tag=ruby&tag=rails ...
Read more >Query string contains repetitive parameters - Sitebulb
Query string contains repetitive parameters. This means that the URL in question contains a query string with the same parameter more than once....
Read more >How to stop passing duplicate parameters for checkbox in ...
By the way what i understood from googling is razor pages taghelper for checkbox will generate two values if we check the chekbox....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’ve just come up against this again and ended up back on this issue! Any progress yet? 😄
+1 having the same issue