Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path with different query parameters should be considered unique #100

Open
OndrejSpanel opened this issue Dec 19, 2023 · 0 comments
Open

Comments

@OndrejSpanel
Copy link

The overloading based on query parameters is inconsistent. When checking routes for overlaps, the parameters are ignored, yet when serving the requests, the overloads are selected based on them.

Following routes are rejected as invalid.

  @cask.get("/hello")
  def hello() = {
    "Hello World!"
  }

  @cask.get("/hello")
  def helloName(name: String) = {
    s"Hello ${name.reverse}"
  }

The error is:

More than one endpoint has the same path: get /hello, get /hello

However when I remove the helloName parameter, requests with the query parameter name are not served.

I suggest query parameters are considered similar to path segments, as following similar routes are valid:

  @cask.get("/hello")
  def hello() = {
    "Hello World!"
  }

  @cask.get("/hello/:name")
  def helloName(name: String) = {
    s"Hello ${name.reverse}"
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant