From 62695b76bc1b2027f297423180ec501b309e4f05 Mon Sep 17 00:00:00 2001 From: Alex Sokol / y9san9 Date: Tue, 31 Oct 2023 19:27:56 +0300 Subject: [PATCH] fix: content negotiation json serialization installed --- api/api-ktor/build.gradle.kts | 1 + .../app/meetacy/sdk/engine/ktor/KtorMeetacyEngine.kt | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/api/api-ktor/build.gradle.kts b/api/api-ktor/build.gradle.kts index e4a35a28..1b2fef2b 100644 --- a/api/api-ktor/build.gradle.kts +++ b/api/api-ktor/build.gradle.kts @@ -12,6 +12,7 @@ dependencies { commonMainImplementation(libs.ktorClientWebSockets) commonMainImplementation(libs.rsocketKtorClient) commonMainImplementation(libs.ktorClientContentNegotiation) + commonMainImplementation(libs.ktorSerializationJson) commonMainApi(projects.api) commonMainImplementation(projects.types.serializable) diff --git a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/KtorMeetacyEngine.kt b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/KtorMeetacyEngine.kt index 4c035978..6f942b84 100644 --- a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/KtorMeetacyEngine.kt +++ b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/KtorMeetacyEngine.kt @@ -26,6 +26,7 @@ import io.ktor.client.plugins.contentnegotiation.* import io.ktor.client.plugins.websocket.* import io.ktor.client.request.* import io.ktor.http.* +import io.ktor.serialization.kotlinx.json.* import io.ktor.utils.io.errors.* import io.rsocket.kotlin.ktor.client.RSocketSupport import kotlinx.coroutines.CancellationException @@ -42,17 +43,14 @@ public class KtorMeetacyEngine( } private val httpClient = httpClient.config { - expectSuccess = true install(WebSockets) install(RSocketSupport) install(ContentNegotiation) { - Json(json) { - ignoreUnknownKeys = true - } + json(json) } defaultRequest { - header(HttpHeaders.ContentType, ContentType.Application.Json.toString()) + header(HttpHeaders.ContentType, ContentType.Application.Json) } }