diff options
author | Li Haoyi <haoyi.li@databricks.com> | 2019-09-14 16:45:39 +0800 |
---|---|---|
committer | Li Haoyi <haoyi.li@databricks.com> | 2019-09-14 17:40:26 +0800 |
commit | 4e853a9d5b9563dbe1909757bf4be4d8e7d2b36a (patch) | |
tree | 684863947658d22f91804090c81a68d012b82b6c /example/endpoints | |
parent | 90b6806e5fb91b207f9d8e2da2a58c25928badea (diff) | |
download | cask-4e853a9d5b9563dbe1909757bf4be4d8e7d2b36a.tar.gz cask-4e853a9d5b9563dbe1909757bf4be4d8e7d2b36a.tar.bz2 cask-4e853a9d5b9563dbe1909757bf4be4d8e7d2b36a.zip |
.
Diffstat (limited to 'example/endpoints')
-rw-r--r-- | example/endpoints/app/src/Endpoints.scala | 3 | ||||
-rw-r--r-- | example/endpoints/app/test/src/ExampleTests.scala | 4 | ||||
-rw-r--r-- | example/endpoints/build.sc | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/example/endpoints/app/src/Endpoints.scala b/example/endpoints/app/src/Endpoints.scala index b478c80..b934769 100644 --- a/example/endpoints/app/src/Endpoints.scala +++ b/example/endpoints/app/src/Endpoints.scala @@ -2,7 +2,8 @@ package app class custom(val path: String, val methods: Seq[String]) extends cask.Endpoint{ type Output = Int - def wrapFunction(ctx: cask.Request, delegate: Delegate): Returned = { + type InnerReturned = Int + def wrapFunction(ctx: cask.Request, delegate: Delegate): OuterReturned = { delegate(Map()).map{num => cask.Response("Echo " + num, statusCode = num) } diff --git a/example/endpoints/app/test/src/ExampleTests.scala b/example/endpoints/app/test/src/ExampleTests.scala index 1302d85..3314f24 100644 --- a/example/endpoints/app/test/src/ExampleTests.scala +++ b/example/endpoints/app/test/src/ExampleTests.scala @@ -4,7 +4,7 @@ import io.undertow.Undertow import utest._ object ExampleTests extends TestSuite{ - def test[T](example: cask.main.BaseMain)(f: String => T): T = { + def withServer[T](example: cask.main.BaseMain)(f: String => T): T = { val server = Undertow.builder .addHttpListener(8080, "localhost") .setHandler(example.defaultHandler) @@ -17,7 +17,7 @@ object ExampleTests extends TestSuite{ } val tests = Tests{ - 'Endpoints - test(Endpoints){ host => + test("Endpoints") - withServer(Endpoints){ host => requests.get(s"$host/echo/200").text() ==> "Echo 200" requests.get(s"$host/echo/200").statusCode ==> 200 requests.get(s"$host/echo/400").text() ==> "Echo 400" diff --git a/example/endpoints/build.sc b/example/endpoints/build.sc index c0e75a7..e4c2108 100644 --- a/example/endpoints/build.sc +++ b/example/endpoints/build.sc @@ -9,7 +9,7 @@ trait AppModule extends ScalaModule{ def testFrameworks = Seq("utest.runner.Framework") def ivyDeps = Agg( - ivy"com.lihaoyi::utest::0.6.9", + ivy"com.lihaoyi::utest::0.7.1", ivy"com.lihaoyi::requests::0.2.0", ) } |