Figured it out
# ktor
a
Figured it out
s
You can’t just leave us hanging like this 😛
a
Haha, i'm not really sure what it was, but I think it had to do with me reading the request body twice with two different receive methods
I fixed it, but unfortunately I do not know how to fix it without writing mutable code
this is what i have right now
Copy code
{
        val multipart = call.receiveMultipart()
//        val params = call.receive<Parameters>()
//        val key = params["key"]

        var key: String = ""
        lateinit var fileItem: PartData.FileItem

        multipart.forEachPart { part ->
            when (part) {
                is PartData.FormItem -> {
                    if (part.name == "key") {
                        key = part.value
                    }
                }
                is PartData.FileItem -> {
                    fileItem = part
                }
            }
        }

        val user = imageService.getUserWithKey(key)

        val response = OutFacingImage(imageService.uploadImage(fileItem, user))

        call.respond(response)

        println(multipart)

        fileItem.dispose
    }
todo error handling, i guess lol
s
So it goes, I suppose ¯\_(ツ)_/¯