Yyq2008
01/30/2020, 9:29 AMpost("/oauth/token") {
val gt = call.parameters.get("grant_type") ?: call.respond(HttpStatusCode.BadRequest, mapOf("error" to "no grant_type specified"));
call.respondText(call.request.headers["Authorization"] ?: "No header")
}
how to response and return to avoid run the second response?spand
01/30/2020, 10:44 AMpost("/oauth/token") {
param("grant_type") {
handle {
val gt = call.parameters.get("grant_type")!! call.respond(HttpStatusCode.BadRequest, mapOf("error" to "no grant_type specified"));
call.respondText(call.request.headers["Authorization"] ?: "No header")
}
}
}
Yyq2008
01/30/2020, 12:27 PMpost("/oauth/token") {
val gt = call.parameters.get("grant_type") ?: run {
call.respond(
HttpStatusCode.BadRequest,
mapOf("error" to "no grant_type specified")
);
return@post
}
call.respondText(call.request.headers["Authorization"] ?: "No header")
}
Dico
01/31/2020, 10:52 AMif (gt == null) {...}
?Yyq2008
02/15/2020, 5:26 AM