Hi, is there an update regarding `br` (Brotli) sup...
# ktor
s
Hi, is there an update regarding
br
(Brotli) support in
ktor-client-encoding
? The only thing I could find is https://github.com/ktorio/ktor/issues/408, but this is closed and the YouTrack link is broken
Solution:
Copy code
implementation("org.brotli:dec:0.1.2")
Copy code
install(ContentEncoding) {
           this.customEncoder(object : ContentEncoder {
               override val name = "br"

               override fun CoroutineScope.decode(source: ByteReadChannel): ByteReadChannel {
                   return BrotliInputStream(source.toInputStream()).toByteReadChannel()
               }

               override fun CoroutineScope.encode(source: ByteReadChannel): ByteReadChannel {
                    TODO()
               }
           })
        }
👍 1
a
The issue in YouTrack now can be seeing by everyone but it contains the same comments as in Github issue.
👍 1
So unfortunately, Ktor doesn’t still have a support for Brotli encoder/decoder.
s
Fortunately it's very easy to use a third party encoder (probably not optimized for
ktor
, but whatever), but I have to use a 2017 release (https://github.com/google/brotli/issues/715)
a
Yeah, the only problem is that it’s not multiplatform.
s
Yeah, also
232 Views