Skip to content

Commit

Permalink
fix: fix Json configuration not applying when using customized `Htt…
Browse files Browse the repository at this point in the history
…pClient`
  • Loading branch information
JellyBrick authored Sep 21, 2024
1 parent 12f3249 commit a59d139
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions core/src/commonMain/kotlin/builder/kord/KordBuilderUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ import kotlinx.serialization.json.Json
internal fun HttpClientConfig<*>.defaultConfig() {
expectSuccess = false

val json = Json {
encodeDefaults = false
allowStructuredMapKeys = true
ignoreUnknownKeys = true
isLenient = true
}

install(ContentNegotiation) {
json()
json(json)
}
install(WebSockets)
}
Expand All @@ -26,18 +33,8 @@ public fun HttpClient?.configure(): HttpClient {
defaultConfig()
}

val json = Json {
encodeDefaults = false
allowStructuredMapKeys = true
ignoreUnknownKeys = true
isLenient = true
}

return HttpClient(httpEngine()) {
defaultConfig()
install(ContentNegotiation) {
json(json)
}
}
}

Expand Down

0 comments on commit a59d139

Please sign in to comment.