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

URI query parse errors during parameter extraction throw an unhandled IllegalUriException #1043

Closed
hgiddens opened this issue Apr 20, 2017 · 0 comments
Labels
3 - in progress Someone is working on this ticket help wanted Identifies issues that the core team will likely not have time to work on t:routing Issues related to the routing DSL
Milestone

Comments

@hgiddens
Copy link
Contributor

If parsing the URI query fails during parameter extraction, the resulting IllegalUriException is unhandled, leading to (by default) a 500 being sent back to the client, rather than a 400 as might be expected.

For example, if we curl -i http://localhost:8080/?a== the following route (appropriately bound):

def route: Route =
  parameter('a) { _ =>
    complete(StatusCodes.OK)
  }

We see in the logs:

/?a==
akka.http.scaladsl.model.IllegalUriException: Illegal query: Invalid input '=', expected part, '&' or 'EOI' (line 1, column 3): a==
  ^

The client receives:

± curl -i 'http://localhost:8080/?a=='
HTTP/1.1 500 Internal Server Error
Server: akka-http/10.0.5
Date: Thu, 20 Apr 2017 14:58:37 GMT
Content-Type: text/plain; charset=UTF-8
Content-Length: 35

There was an internal server error.
@ktoso ktoso added 3 - in progress Someone is working on this ticket help wanted Identifies issues that the core team will likely not have time to work on t:routing Issues related to the routing DSL labels Apr 24, 2017
@ktoso ktoso added this to the 10.0.6 milestone Apr 24, 2017
tomrf1 pushed a commit to tomrf1/akka-http that referenced this issue Aug 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - in progress Someone is working on this ticket help wanted Identifies issues that the core team will likely not have time to work on t:routing Issues related to the routing DSL
Projects
None yet
Development

No branches or pull requests

2 participants