|
@@ -1,4 +1,4 @@
|
|
-import org.http4k.asByteBuffer
|
|
|
|
|
|
+
|
|
import org.http4k.core.Body
|
|
import org.http4k.core.Body
|
|
import org.http4k.core.ContentType.Companion.TEXT_PLAIN
|
|
import org.http4k.core.ContentType.Companion.TEXT_PLAIN
|
|
import org.http4k.core.Method.GET
|
|
import org.http4k.core.Method.GET
|
|
@@ -9,9 +9,9 @@ import org.http4k.lens.binary
|
|
import org.http4k.routing.bind
|
|
import org.http4k.routing.bind
|
|
|
|
|
|
object PlainTextRoute {
|
|
object PlainTextRoute {
|
|
- private val preAllocatedHelloWorldText = "Hello, World!".asByteBuffer()
|
|
|
|
|
|
+ private val preAllocatedHelloWorldText = "Hello, World!".byteInputStream()
|
|
|
|
|
|
private val plainTextBody = Body.binary(TEXT_PLAIN).toLens()
|
|
private val plainTextBody = Body.binary(TEXT_PLAIN).toLens()
|
|
|
|
|
|
- operator fun invoke() = "/plaintext" bind GET to { Response(OK).with(plainTextBody of preAllocatedHelloWorldText) }
|
|
|
|
|
|
+ operator fun invoke() = "/plaintext" bind GET to { Response(OK).with(plainTextBody of Body(preAllocatedHelloWorldText)) }
|
|
}
|
|
}
|