June 2018
Intermediate to advanced
310 pages
6h 32m
English
We'll create two helper functions in our test, called get() and post(), which will issue GET and POST requests to our test server.
We'll start with get():
private fun get(path: String): HttpResponse<Buffer> { val d1 = CompletableDeferred<HttpResponse<Buffer>>() val client = WebClient.create(vertx) client.get(8080, "localhost", path).send { d1.complete(it.result()) } return runBlocking { d1.await() }}
The second method, post(), will look very similar, but it will also have a request body parameter:
private fun post(path: String, body: String = ""): HttpResponse<Buffer> { val d1 = CompletableDeferred<HttpResponse<Buffer>>() val client = WebClient.create(vertx) client.post(8080, "localhost", path).sendBuffer(Buffer.buffer(body) ...
Read now
Unlock full access