【发布时间】:2021-05-12 13:47:48
【问题描述】:
我尝试执行 GET 请求,但收到此错误。
这里的Bug很明显,但我不知道是什么问题。
suspend fun getNotesForUser(email: String) = notes.find(Note::owners contains email).toList()
这是路线代码
route("/getNotes") {
authenticate {
get {
val email = call.principal<UserIdPrincipal>()!!.name
val notes = getNotesForUser(email)
call.respond(OK, notes)
}
}
}
笔记类:
data class Note(
val title: String,
val content: String,
val date: Long,
val owners: List<String>,
val color: String,
@BsonId
val id: String = ObjectId().toString()
我所有的 POST 请求都在工作,但这个 GET 没有。
【问题讨论】: