Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Jan 5, 2024
1 parent 76fe751 commit 6af2232
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cask/src/cask/main/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ object Main{
(r: Any) => Main.writeResponse(exchange, r.asInstanceOf[Response.Raw])
)

dispatchTrie.lookup(Util.splitPath(exchange.getRequestPath).toList, Map()) match {
dispatchTrie.lookup(Util.splitPath(java.net.URLDecoder.decode(exchange.getRequestURI, "UTF-8")).toList, Map()) match {
case None => Main.writeResponse(exchange, handleNotFound())
case Some((methodMap, routeBindings, remaining)) =>
methodMap.get(effectiveMethod) match {
Expand Down
8 changes: 4 additions & 4 deletions example/queryParams/app/test/src/ExampleTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ object ExampleTests extends TestSuite{
val noIndexPage = requests.get(host, check = false)
noIndexPage.statusCode ==> 404

assert(
requests.get(s"$host/article/123?param=xyz").text() ==
"Article 123 xyz"
)
requests.get(s"$host/article/123?param=xyz").text() ==> "Article 123 xyz"

requests.get(s"$host/article/123?param=1+%2B+1+%3D+2%25%3F%26").text() ==>
"Article 123 1 + 1 = 2%?&"

requests.get(s"$host/article/123", check = false).text() ==>
"""Missing argument: (param: String)
Expand Down
2 changes: 2 additions & 0 deletions example/variableRoutes/app/test/src/ExampleTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ object ExampleTests extends TestSuite{
noIndexPage.statusCode ==> 404

requests.get(s"$host/user/lihaoyi").text() ==> "User lihaoyi"
requests.get(s"$host/user/li+haoyi").text() ==> "User li haoyi"
requests.get(s"$host/user/1+%2B+1+%3D+2%25%3F%26").text() ==> "User 1 + 1 = 2%?&"

requests.get(s"$host/user", check = false).statusCode ==> 404

Expand Down

0 comments on commit 6af2232

Please sign in to comment.