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
4
4
import io.ktor.client.call.*
5
5
import io.ktor.client.plugins.*
6
6
import io.ktor.client.plugins.resources.*
7
+ import io.ktor.http.HttpMethod
7
8
import io.ktor.http.content.*
8
9
import io.ktor.resources.*
9
10
import kotlinx.serialization.Serializable
@@ -60,7 +61,12 @@ data class MediaApiClient(
60
61
61
62
suspend fun images () = client.get(ImgRes ()).body<List <Image >>()
62
63
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
+ }
64
70
65
71
suspend fun multiPart () {
66
72
val multipart = client.post(MultiPartRes ()).body<MultiPartData >()
Original file line number Diff line number Diff line change 1
1
package dev.suresh.http
2
2
3
- import io.github.oshai.kotlinlogging.KLogger
3
+ import io.github.oshai.kotlinlogging.*
4
4
import io.ktor.client.*
5
5
import io.ktor.client.engine.curl.*
6
+ import kotlinx.io.files.*
6
7
7
8
actual fun httpClient (
8
9
name : String ,
@@ -15,10 +16,10 @@ actual fun httpClient(
15
16
config(this )
16
17
engine {
17
18
// 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 " }
22
23
}
23
24
sslVerify = true
24
25
}
You can’t perform that action at this time.
0 commit comments