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.

Strict query parameter matching

See original GitHub issue

if I have this case in my HttpService

object OptionalYearQueryParamMatcher extends OptionalQueryParamDecoderMatcher[Int]("year")
...
case GET -> Root / "temperature" :? OptionalYearQueryParamMatcher(maybeYear) =>

it matches requests like http://localhost/temperature or http://localhost/temperature?year=1 and that’s fine.

but it also matches http://localhost/temperature?superfluous=someval or http://localhost/temperature?year=1&superfluous=someval

is there a way to do strict matching on the query parameters that doesn’t allow any superfluous parameters to be present?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
rossabakercommented, Apr 6, 2021

The workaround with the if-guard seems to be sufficient here.

1reaction
aeonscommented, Apr 26, 2019

The label literally means request for comments 😃 To get input from users on how this case should be handles so everyone’s happy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request Matching - WireMock
Stub matching and verification queries can use the following request attributes: URL; HTTP Method; Query parameters; Headers; Basic authentication (a ...
Read more >
REST pattern for for query parameters that might be LIKE ...
Hi I'm building a RESTful app and can't find the recommended way to pattern optional fuzzy or LIKE queries. For example a strict...
Read more >
Query Parameters and String Validations - FastAPI
The query parameter q is of type Union[str, None] (or str | None in Python 3.10), ... You can define a regular expression...
Read more >
Request matching - Basics - Mock Service Worker Docs
* request handlers allows you to match requests by the following criteria: Request method;; Request URL. Query parameters and hashes are removed ...
Read more >
Request Handling — Connexion 3.0.dev0 documentation
All you need to do is define the endpoint's parameters with matching ... Connexion can apply strict parameter validation for query and form...
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