1.0.1
ktor-client, ktor-client-android and ktor-client-ios
iOS
We are developing a multiplatform app for Android and iOS. While for Android everything works smoothly, we are facing an issue with iOS version and Ktor client. It seems that randomly, calling the API, the response is truncated and we receive partial JSON data. We also tried starting from scratch using the Ktor Sample MPP App and we have the same behaviour simply changing the endpoint.
Here the Ktor sample app code changed:
package io.ktor.samples.mpp.client
import io.ktor.client.*
import io.ktor.client.request.*
import io.ktor.http.*
import kotlinx.coroutines.*
internal expect val ApplicationDispatcher: CoroutineDispatcher
class ApplicationApi {
private val client = HttpClient()
//var address = Url("https://tools.ietf.org/rfc/rfc1866.txt")
var address = Url("https://newsapi.org/v2/top-headlines?apiKey=cfe7a44a40e041ccaf8b9de9b1c71c28&country=us")
fun about(callback: (String) -> Unit) {
GlobalScope.apply {
launch(ApplicationDispatcher) {
val result: String = client.get {
url([email protected]())
}
callback(result)
}
}
}
}
Hi, @spawn150. Thanks for the report.
It's obviously a bug and would be fixed in the next minor release.
Hi @e5l , I have the exact same issue. I'm developing a multiplatform app that calls some rest apis and the response randomly gets truncated. Do you know when the fix could be available?
Thanks
Could you reproduce the issue with 1.1.2?
Fixed by Kotlin/kotlinx-io#36
Fixed in 1.1.3.
Most helpful comment
Hi, @spawn150. Thanks for the report.
It's obviously a bug and would be fixed in the next minor release.