Skip to content

Commit

Permalink
added a quick test for query string
Browse files Browse the repository at this point in the history
  • Loading branch information
ajusa authored and dom96 committed Jan 22, 2022
1 parent 6bf2b16 commit a1829e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions tests/alltest.nim
Expand Up @@ -218,5 +218,8 @@ routes:
get "/query":
resp $request.params

get "/querystring":
resp $request.query

get "/issue157":
resp(Http200, [("Content-Type","text/css")] , "foo")
6 changes: 5 additions & 1 deletion tests/tester.nim
Expand Up @@ -146,6 +146,10 @@ proc allTest(useStdLib: bool) =
let resp = waitFor client.get(address & "/foo/query?q=test")
check (waitFor resp.body) == """{"q": "test"}"""

test "can access querystring":
let resp = waitFor client.get(address & "/foo/querystring?q=test&field=5")
check (waitFor resp.body) == "q=test&field=5"

test "issue 157":
let resp = waitFor client.get(address & "/foo/issue157")
let headers = resp.headers
Expand Down Expand Up @@ -261,4 +265,4 @@ when isMainModule:
let path = "tests/nim-in-action-code/Chapter7/Tweeter/src/tweeter.nim"
check execCmd("nim c --path:. " & path) == QuitSuccess
finally:
doAssert execCmd("kill -15 " & $serverProcess.processID()) == QuitSuccess
doAssert execCmd("kill -15 " & $serverProcess.processID()) == QuitSuccess

0 comments on commit a1829e3

Please sign in to comment.