File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
commonMain/kotlin/dev/suresh/http
nativeMain/kotlin/dev/suresh/http Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import io.github.oshai.kotlinlogging.KotlinLogging
44import io.ktor.client.call.*
55import io.ktor.client.plugins.*
66import io.ktor.client.plugins.resources.*
7+ import io.ktor.http.HttpMethod
78import io.ktor.http.content.*
89import io.ktor.resources.*
910import 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 >()
Original file line number Diff line number Diff line change 11package dev.suresh.http
22
3- import io.github.oshai.kotlinlogging.KLogger
3+ import io.github.oshai.kotlinlogging.*
44import io.ktor.client.*
55import io.ktor.client.engine.curl.*
6+ import kotlinx.io.files.*
67
78actual 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 }
You can’t perform that action at this time.
0 commit comments