I want to control the Content-Length and Transfer-Encoding header for an http file download endpoint. I want to ensure that clients can see the Content-Length (so they know how much needs downloaded), and use gzip (to minimize the size). I'm planning on storing most of the files gzipped on disk anyway.
As per this issue:
https://youtrack.jetbrains.com/issue/KTOR-3242
It's not allowed to set that header. The ContentEncoder interface does not support reporting on the output size (which, in my case, I already know because the file is stored gzipped):
https://ktor.io/docs/content-encoding.html#install_plugin
When I used the encoding plugin, the content-length is not specified and chunked encoding is used.
Is there something I'm missing that would allow controlling transfer encoding?