summaryrefslogtreecommitdiff
path: root/example/decorated
diff options
context:
space:
mode:
Diffstat (limited to 'example/decorated')
-rw-r--r--example/decorated/app/src/Decorated.scala8
-rw-r--r--example/decorated/app/test/src/ExampleTests.scala4
-rw-r--r--example/decorated/build.sc2
3 files changed, 7 insertions, 7 deletions
diff --git a/example/decorated/app/src/Decorated.scala b/example/decorated/app/src/Decorated.scala
index f037c6a..a88bd2e 100644
--- a/example/decorated/app/src/Decorated.scala
+++ b/example/decorated/app/src/Decorated.scala
@@ -3,13 +3,13 @@ object Decorated extends cask.MainRoutes{
class User{
override def toString = "[haoyi]"
}
- class loggedIn extends cask.Decorator {
- def wrapFunction(ctx: cask.Request, delegate: Delegate): Returned = {
+ class loggedIn extends cask.RawDecorator {
+ def wrapFunction(ctx: cask.Request, delegate: Delegate): OuterReturned = {
delegate(Map("user" -> new User()))
}
}
- class withExtra extends cask.Decorator {
- def wrapFunction(ctx: cask.Request, delegate: Delegate): Returned = {
+ class withExtra extends cask.RawDecorator {
+ def wrapFunction(ctx: cask.Request, delegate: Delegate): OuterReturned = {
delegate(Map("extra" -> 31337))
}
}
diff --git a/example/decorated/app/test/src/ExampleTests.scala b/example/decorated/app/test/src/ExampleTests.scala
index 9aea3bc..c2c19a6 100644
--- a/example/decorated/app/test/src/ExampleTests.scala
+++ b/example/decorated/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{
- 'Decorated - test(Decorated){ host =>
+ test("Decorated") - withServer(Decorated){ host =>
requests.get(s"$host/hello/woo").text() ==> "woo31337"
requests.get(s"$host/internal/boo").text() ==> "boo[haoyi]"
requests.get(s"$host/internal-extra/goo").text() ==> "goo[haoyi]31337"
diff --git a/example/decorated/build.sc b/example/decorated/build.sc
index c0e75a7..e4c2108 100644
--- a/example/decorated/build.sc
+++ b/example/decorated/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",
)
}