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.

Query String parameters break the url matching

See original GitHub issue

If I stub an url like:

stubFor(get(urlMatching("/my/url")) 
                    .willReturn(aResponse().withStatus(200)
                    .withBodyFile("my_.json")));

querying /my/url?param=value will not match that url and return a 404, but the logs and the error message it will show the stripped url (without the query string parameter).

So in the logs you see the test registering /my/url, and then a call to /my/url returning a 404.

The expected behavior should probably be to either:

  • ignore the query string params when matching the urls
  • take them into account but then update the 404 error to show the full url.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
tomakehurstcommented, Mar 12, 2014

urlMatching() takes a regex. Try: /my/url.*

0reactions
tomakehurstcommented, Dec 31, 2014

Closing as 1.52 has query param matching.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Query String parameters break the url matching #110 - GitHub
If I stub an url like: stubFor(get(urlMatching("/my/url")) .willReturn(aResponse().withStatus(200) .withBodyFile("my_.json"))); querying ...
Read more >
Separate URL & Query String - RegExr
Matches any character except line breaks. * Quantifier. Match 0 or more of the preceding token. ) ? Quantifier. Match ...
Read more >
Regex in URL Rewriting to match Querystring Parameter ...
I need some URLs to be matched against a couple of main querystring parmeter values no matter what order they appear in. For...
Read more >
How to Use Query Strings and Parameters for Marketers
This is a guide on query strings and parameters for marketers. Learn how to use text in a URL (query strings) for UTM...
Read more >
4 Ways to Get Value from Query string | by bitbug
The query string of the URL is in the form of key=value&key=value , therefore the value of a single key can be obtained...
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