Cześć mam problem, tworzę aplikacje za pomocą ktora, kod:
get<Request> {
val account = service.getAccount(it.name)
account
.peek { call.respond(it) }
.onEmpty { call.respond("error") }
}
przy próbie zwrócenia wyniku call.respond()
dostaje błąd: "suspension function can be called only within coroutine body"
Da się to jakoś elegancko rozwiązać czy pozostaje?
val account = service.getAccount(it.name).orNull
if (account != null) {
call.respond(account)
} else {
call.respond("error")
}