spierce7
01/14/2022, 3:55 AMAleksei Tirman [JB]
01/14/2022, 6:51 AMGZIPInputStream
to decode incoming request body:
post("/") {
val encoding = (call.request.headers[HttpHeaders.ContentEncoding] ?: "").trim().lowercase()
if (encoding == "gzip") {
val channel = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
GZIPInputStream(call.receiveStream()).toByteReadChannel()
}
call.respond(object : OutgoingContent.ReadChannelContent() {
override fun readFrom(): ByteReadChannel = channel
})
}
}
Also, there is a feature request to support it out of the box.spierce7
01/14/2022, 4:03 PM