Skip to content

Path with different query parameters should be considered unique #100

Open
@OndrejSpanel

Description

@OndrejSpanel

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}"
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions