Ray Eldath
01/26/2020, 6:40 AMresponseLens
and use returning
to specify it in contract route. But I want to know is it possible to constraint and auto-marshalling for request? like
data class LoginRequest(val email: String, val password: String) {
init {
require(EmailValidator.getInstance().isValid(email))
}
}
val requestLens = Body.auto<LoginRequest>("Login essentials.")
fun handler(login: LoginRequest): HttpHandler = { req: Request -> ... }
"/login" / Body.of(requestLens) meta {
...
} bindContract <http://Method.POST|Method.POST> to ::handler
Many thanks.dave
01/26/2020, 8:15 AMRay Eldath
01/26/2020, 6:43 PM