【发布时间】:2020-02-25 17:18:22
【问题描述】:
如何在 Ktor http 客户端监控请求进度?
例如:我有这样的要求:
val response = HttpClient().get<String>("https://stackoverflow.com/")
我想用这样的进度条监控请求进度:
fun progress(downloaded: Long, contentLength: Long) {
// Update progress bar or whatever
}
如何设置progress()被HttpClient调用?
编辑:这是 Kotlin 多平台项目。相关依赖有:
implementation 'io.ktor:ktor-client-core:1.2.5'
implementation 'io.ktor:ktor-client-cio:1.2.5'
【问题讨论】: