diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-07-20 16:26:13 +0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-07-20 16:26:13 +0800 |
commit | 4a132ef40e944e0f970aabbd5a8c1d3b38b1f91c (patch) | |
tree | 941943b3da4087fa7fc99b236c826d0115765244 /cask/test/src/test/cask | |
parent | 72e3be9c0076bd02df697b56f4f7a324cec1b377 (diff) | |
download | cask-4a132ef40e944e0f970aabbd5a8c1d3b38b1f91c.tar.gz cask-4a132ef40e944e0f970aabbd5a8c1d3b38b1f91c.tar.bz2 cask-4a132ef40e944e0f970aabbd5a8c1d3b38b1f91c.zip |
Threading through context values into the argument parsers now works
Diffstat (limited to 'cask/test/src/test/cask')
-rw-r--r-- | cask/test/src/test/cask/CaskTest.scala | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/cask/test/src/test/cask/CaskTest.scala b/cask/test/src/test/cask/CaskTest.scala index 01c905a..a2e0f47 100644 --- a/cask/test/src/test/cask/CaskTest.scala +++ b/cask/test/src/test/cask/CaskTest.scala @@ -1,21 +1,38 @@ package test.cask +import io.undertow.io.Receiver.{ErrorCallback, FullBytesCallback} +import io.undertow.server.HttpServerExchange + object MyServer extends cask.Routes{ @cask.get("/user/:userName") def showUserProfile(userName: String) = { s"User $userName" } - @cask.post("/post/:postId") - def showPost(postId: Int, query: String) = { + @cask.get("/post/:postId") + def showPost(postId: Int, query: Seq[String]) = { s"Post $postId $query" } - @cask.put("/path/::subPath") - def showSubpath(subPath: String) = { + @cask.get("/path/::subPath") + def showSubpath(x: HttpServerExchange, subPath: String) = { + x.getRequestReceiver().receiveFullBytes((exchange, data) => { + + }: FullBytesCallback, + (exchange, exception) => { + + }: ErrorCallback + ) + println(x) s"Subpath $subPath" } +// @cask.post("/echo-size") +// def echoSize(x: HttpServerExchange, subPath: String) = { +// println(x) +// s"Subpath $subPath" +// } + initialize() } |