question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Verify request with duplicate query params

See original GitHub issue

I’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:open
  • Created 7 years ago
  • Reactions:15
  • Comments:24

github_iconTop GitHub Comments

6reactions
tddmonkeycommented, Jul 26, 2019

We’ve just come up against this again and ended up back on this issue! Any progress yet? 😄

6reactions
prestonparriscommented, Oct 13, 2016

+1 having the same issue

Read more comments on GitHub >

github_iconTop 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 >
Bountysource
Verify request with duplicate query params.
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found