https://kotlinlang.org logo
#ktor
Title
# ktor
b

bitkid

09/23/2019, 2:53 PM
i try to upload a gzipped file as multipart content like this
Copy code
addHeader(HttpHeaders.ContentType, ContentType.MultiPart.FormData.withParameter("boundary", boundary).toString())
            setBody(boundary, listOf(
                    PartData.FileItem({ file.inputStream().asInput() }, {}, headersOf(
                            HttpHeaders.ContentDisposition,
                            ContentDisposition.File
                                    .withParameter(ContentDisposition.Parameters.Name, "file")
                                    .withParameter(ContentDisposition.Parameters.FileName, "file.txt")
                                    .toString()
                    ))
            ))
but when i get it on the server side like this
Copy code
GZIPInputStream(part.streamProvider())
it complains "Not in GZIP format" .. when i try the same code with the file directly it works. any ideas?
hmm weird .. if i read all bytes and then do GZIPInputStream(ByteArrayInputStream(bytes)) it works .. but directly using GZIPInputStream(part.streamProvider()) does not
wtf .. this also works GZIPInputStream(part.streamProvider().buffered())
9 Views