Skip to content

Commit 7878daa

Browse files
committed
chore: ktor 3.2.0 update
1 parent 9ad6b48 commit 7878daa

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

shared/src/commonMain/kotlin/dev/suresh/http/MediaApiClient.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import io.github.oshai.kotlinlogging.KotlinLogging
44
import io.ktor.client.call.*
55
import io.ktor.client.plugins.*
66
import io.ktor.client.plugins.resources.*
7+
import io.ktor.http.HttpMethod
78
import io.ktor.http.content.*
89
import io.ktor.resources.*
910
import kotlinx.serialization.Serializable
@@ -60,7 +61,12 @@ data class MediaApiClient(
6061

6162
suspend fun images() = client.get(ImgRes()).body<List<Image>>()
6263

63-
suspend fun videos() = client.get(VideoRes()) { skipSavingBody() }.body<List<Video>>()
64+
suspend fun videos() = suspend{
65+
val s = client.prepareRequest(ImgRes()) {
66+
this.method = HttpMethod.Get
67+
}
68+
client.get(VideoRes()).body<List<Video>>()
69+
}
6470

6571
suspend fun multiPart() {
6672
val multipart = client.post(MultiPartRes()).body<MultiPartData>()

shared/src/nativeMain/kotlin/dev/suresh/http/HttpClient.native.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package dev.suresh.http
22

3-
import io.github.oshai.kotlinlogging.KLogger
3+
import io.github.oshai.kotlinlogging.*
44
import io.ktor.client.*
55
import io.ktor.client.engine.curl.*
6+
import kotlinx.io.files.*
67

78
actual fun httpClient(
89
name: String,
@@ -15,10 +16,10 @@ actual fun httpClient(
1516
config(this)
1617
engine {
1718
// https://youtrack.jetbrains.com/issue/KTOR-8339
18-
val cacertPath = "/etc/ssl/certs"
19-
if (Platform.osFamily == OsFamily.LINUX) {
20-
caPath = cacertPath
21-
kLogger.warn { "Setting CA path to $caPath" }
19+
val cacertBundle = "/etc/ssl/certs/ca-certificates.crt"
20+
if (Platform.osFamily == OsFamily.LINUX && SystemFileSystem.exists(Path(cacertBundle))) {
21+
caInfo = cacertBundle
22+
kLogger.warn { "Setting cacertBundle to $caInfo" }
2223
}
2324
sslVerify = true
2425
}

0 commit comments

Comments
 (0)