Hey! I have an issue with creating a progress bar...
# ktor
j
Hey! I have an issue with creating a progress bar with ktor client in javascript using
onDownload
as described in the documentation here: https://ktor.io/docs/response.html#raw I have this code:
Copy code
httpClient.get(url) {
                        onDownload { bytesSentTotal: Long, contentLength: Long ->
                            println("Downloaded $bytesSentTotal bytes out of $contentLength at time ${Clock.System.now()}")
                        }
                    }
In the browser, this first downloads the whole file and emits all the console logs at once after the download has already finished. I'm attaching part of the log to show how all the logs were emitted in less than a seconds while the actual download of the file took more than 7 seconds. Is there something I'm doing wrong here or another fix to this? I'm using ktor version 2.3.7 Edit: I seem to be able to replicate this issue on jvm as well 👀 🎉 Found the cause, it was the ktor
HttpCache
plugin! Should I open an issue for this?
a
Please file the issue with the code snippet for JVM attached.