У меня проблемы с использованием POST, GET с Spark в kotlin. Код не публикуется, когда его создает бот;GET https://prnt.sc/po98gf, GET https://prnt.sc/po98t3, Именно здесь должен работать метод POST, но он не https://prnt.sc/po98xu, Discord Bot https://prnt.sc/po9903
код:
init {
val codes = ArrayList<String>()
port(8880)
threadPool(10, 5, 1000)
post("/bot/:newCode") { req, res ->
val newCode = req.params(":newCode")
if (newCode.length == 8 && newCode.chars().allMatch(Character::isDigit)) {
codes.add(newCode)
println("$newCode is all numbers")
return@post "success"
}
"failure"
}
get("/ss/:code") { req, res ->
val enteredCode = req.params(":code")
if (codes.contains(enteredCode)) {
return@get "success"
}
"fail"
}