Hello all. I am using ktor in Android+iOS, but I h...
# ktor
h
Hello all. I am using ktor in Android+iOS, but I have a problem with ktor not downloading the entire file always. When downloading to ByteArray, the array does not contain all the bytes of the file. Any ideas why? Is this call not blocking, so I read it prematurely or similar? Using ktor 1.3.1 and Kotlin 1.3.61
Copy code
private val client = HttpClient()
val result: ByteArray = client.get {
                        url(url.toString())
                    }
m
Could it be a multipart-file?
h
It is just a standard JPG file I try to download
m
Sure, but the sender might split it up and send it in multiple parts. What's the content type of the request?
h
I have not set any request content type. The response content type is "image/jpeg", and the Content-Length header is specified to the full expected length
m
👍 I meant response, but somehow wrote request
h
When run on Android it downloads all bytes, but the exact same code (MPP) on iOS skips some bytes
e
There was a similar issue in iOS and it was fixed recently: https://github.com/ktorio/ktor/issues/1639
The fix in
master
and will be released in
1.3.2
h
Thanks, but that appears to be only when using ByteReadChannel? Might be the same though. Any idea when 1.3.2 is out?
e
Yep, and the
ByteArray
content works through
ByteReadChannel
h
I see, thanks a lot! Is there a roadmap somewhere where I can see when the next release will be out?
e
We’re preparing for the end of this week.
h
Perfect, thank you 🙂
@e5l Any news on when 1.3.2 will be out?
e
We’re building the release
h
Thanks, it seems it works now, if I change get<ByteArray> to HttpResponse, and get the ByteArray from there!
e
Thanks for checking, btw It also should work with get<ByteArray>