Browse Source

Fix the plaintext test and all database tests for http4k (#3048)

Michael Hixson 7 years ago
parent
commit
d3cdfc3631

+ 7 - 5
frameworks/Kotlin/http4k/core/src/main/kotlin/Http4kBenchmarkServer.kt

@@ -20,14 +20,16 @@ object Http4kBenchmarkServer {
         }
     }
 
+    private val database = Database("TFB-database")
+
     fun start(config: ServerConfig) = headers.then(
         routes(
             JsonRoute(),
-            PlainTextRoute()
-//            FortunesRoute(database),
-//            WorldRoutes.queryRoute(database),
-//            WorldRoutes.updateRoute(database),
-//            WorldRoutes.multipleRoute(database)
+            PlainTextRoute(),
+            FortunesRoute(database),
+            WorldRoutes.queryRoute(database),
+            WorldRoutes.updateRoute(database),
+            WorldRoutes.multipleRoute(database)
         )
     ).asServer(config).start().block()
 }

+ 2 - 2
frameworks/Kotlin/http4k/core/src/main/kotlin/PlainTextRoute.kt

@@ -1,4 +1,4 @@
-
+import org.http4k.asByteBuffer
 import org.http4k.core.Body
 import org.http4k.core.ContentType.Companion.TEXT_PLAIN
 import org.http4k.core.Method.GET
@@ -9,7 +9,7 @@ import org.http4k.lens.binary
 import org.http4k.routing.bind
 
 object PlainTextRoute {
-    private val preAllocatedHelloWorldText = "Hello, World!".byteInputStream()
+    private val preAllocatedHelloWorldText = "Hello, World!".asByteBuffer()
 
     private val plainTextBody = Body.binary(TEXT_PLAIN).toLens()