Nick
03/09/2025, 10:24 PMfun Applcation.configureRouting() {
routing {
get("/healthcheck") {
call.respond(HttpStatusCode.OK, mapOf("versions" to "0.1"))
}
}
}
And I get an error under mapOf()
that it's expecting TypeInfo
Type mismatch.
Required: TypeInfo?
Found: Map<String, String>
this isn't my first Ktor app and I swear in my other ones I do this all the time (returning a status code along with the serializable object)
When I look at another one of my apps, I'm using it the exact same way, but it's using the call.respond
that is in ApplicationResponseFunctionKt.class
, and in this new app, it's in RoutingNode.kt
. Also noticed in the working project, call
is an ApplcationCall
and in the not working project, call
is a RoutingCall
Not really sure what I'm doing wrong. I have routing configured identically in both projects.
EDIT: Fixed. Just IntelliJ being IntelliJ and not auto importing. I had to manually import io.ktor.server.response.respond
for it to work.