Alice
12/02/2018, 1:32 AM20:30:23.445 [nettyCallPool-4-3] ERROR ktor.application - Unhandled: POST - /api/images/upload
kotlinx.coroutines.channels.ClosedReceiveChannelException: Unexpected EOF: expected 44 more bytes
Here is the route
fun Route.upload(imageService: ImageService) {
post("/upload") {
val multipart = call.receiveMultipart()
val params = call.receive<Parameters>()
val key = params["key"]
println(multipart)
println(key)
if (key != null) {
val user = imageService.getUserWithKey(key)
multipart.forEachPart { part ->
if (part is PartData.FileItem) {
val imageResponseMap = OutFacingImage(imageService.uploadImage(part, user))
call.respond(imageResponseMap)
}
}
}
}
}