Skip to content

Commit 4f9b213

Browse files
committed
chore: More http client plugins
1 parent ff810c2 commit 4f9b213

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gradle/build-logic/common-plugins/src/main/kotlin/common/ServiceClient.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import io.ktor.client.engine.java.*
66
import io.ktor.client.plugins.*
77
import io.ktor.client.plugins.compression.*
88
import io.ktor.client.plugins.contentnegotiation.*
9+
import io.ktor.client.plugins.cookies.*
910
import io.ktor.client.plugins.logging.*
1011
import io.ktor.client.plugins.resources.*
1112
import io.ktor.client.plugins.resources.Resources
@@ -23,6 +24,7 @@ object ApiClient {
2324
fun get() =
2425
HttpClient(Java) {
2526
install(Resources)
27+
2628
install(ContentNegotiation) {
2729
json(
2830
Json {
@@ -31,20 +33,27 @@ object ApiClient {
3133
ignoreUnknownKeys = true
3234
})
3335
}
36+
3437
install(ContentEncoding) {
3538
deflate(1.0F)
3639
gzip(0.9F)
3740
}
41+
3842
install(HttpTimeout) {
3943
requestTimeoutMillis = 20_000
4044
connectTimeoutMillis = 5_000
4145
socketTimeoutMillis = 5_000
4246
}
47+
4348
install(Logging) {
4449
logger = Logger.DEFAULT
4550
level = LogLevel.INFO
4651
}
52+
53+
install(HttpCookies)
54+
4755
engine { pipelining = true }
56+
4857
defaultRequest {
4958
url {
5059
protocol = URLProtocol.HTTPS

0 commit comments

Comments
 (0)