Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (16 sloc) 622 Bytes
package cookbook.container_integration
import org.http4k.client.ApacheClient
import org.http4k.core.Method
import org.http4k.core.Request
import org.http4k.core.Response
import org.http4k.core.Status.Companion.OK
import org.http4k.server.Jetty
import org.http4k.server.asServer
fun main() {
val app = { request: Request -> Response(OK).body("Hello, ${request.query("name")}!") }
val jettyServer = app.asServer(Jetty(9000)).start()
val request = Request(Method.GET, "http://localhost:9000").query("name", "John Doe")
val client = ApacheClient()
println(client(request))
jettyServer.stop()
}