Ah, wasn't aware that response followed the builde...
# announcements
r
Ah, wasn't aware that response followed the builder pattern. Nice! In that case though, you could leave out the
let
-call entirely, right? Just do it like this:
Copy code
fun <T> response(req: HttpServerRequest): Handler<AsyncResult<T>> = Handler {
        val (statusCode, body) = if (it.succeeded()) 200 to it.result() else 500 to it.cause()
        req.response().setStatusCode(statusCode).write(body?.toString() ?: "null").end()
    }