Every time I send a post request from the postman and the server gives this error, even I checked if I'm receiving Content-Type = Application/ JSON
. But still giving this error.
Caused by: java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
Here are my files
Application File:
fun main() {
embeddedServer(Netty, port = 8080, host = "192.168.0.109") {
install(ContentNegotiation){
json()
}
configureRouting()
}.start(wait = true)
}
Request:
post("/login") {
val userInfo = call.receive<UserInfo>()
println(userInfo)
call.respondText("Everything is working fine")
}
Model Class:
@Serializable
data class UserInfo(
val email: String,
val password: String
)
Santiago Trujillo