diff --git a/modules/openid-federation-client/src/jsMain/kotlin/com/sphereon/oid/fed/client/fetch/Fetch.js.kt b/modules/openid-federation-client/src/jsMain/kotlin/com/sphereon/oid/fed/client/fetch/Fetch.js.kt index 99ac72b6..bbbd54f7 100644 --- a/modules/openid-federation-client/src/jsMain/kotlin/com/sphereon/oid/fed/client/fetch/Fetch.js.kt +++ b/modules/openid-federation-client/src/jsMain/kotlin/com/sphereon/oid/fed/client/fetch/Fetch.js.kt @@ -1,14 +1,12 @@ package com.sphereon.oid.fed.client.fetch import com.sphereon.oid.fed.client.crypto.AbstractCryptoService -import com.sphereon.oid.fed.client.crypto.CryptoConst import com.sphereon.oid.fed.client.service.DefaultCallbacks -import com.sphereon.oid.fed.client.trustchain.TrustChainConst -import io.ktor.client.HttpClient -import io.ktor.client.call.body -import io.ktor.client.engine.js.Js +import io.ktor.client.* +import io.ktor.client.engine.js.* import io.ktor.client.request.get -import io.ktor.http.HttpHeaders +import io.ktor.client.statement.* +import io.ktor.http.* import io.ktor.http.headers import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.CoroutineScope @@ -62,7 +60,6 @@ class FetchServiceJSAdapter(val fetchCallbackJS: FetchServiceJS = FetchServiceJS override suspend fun fetchStatement(endpoint: String): String { val result = this.platformCallback.fetchStatement(endpoint).await() - TrustChainConst.LOG.info("fetchStatement returned ${result}") return result } @@ -94,12 +91,13 @@ class DefaultFetchJSImpl : IFetchCallbackServiceJS { override fun fetchStatement(endpoint: String): Promise { return CoroutineScope(context = CoroutineName(FETCH_SERVICE_JS_SCOPE)).async { - return@async getHttpClient().await().get(endpoint) { + val client = getHttpClient().await() + val response = client.get(endpoint) { headers { append(HttpHeaders.Accept, "application/entity-statement+jwt") - append(HttpHeaders.AcceptCharset, "iso-8859-1, us-ascii, utf-8") } - }.body() as String + } + return@async response.bodyAsText() }.asPromise() } } diff --git a/modules/openid-federation-client/src/jvmMain/kotlin/com/sphereon/oid/fed/client/fetch/Fetch.jvm.kt b/modules/openid-federation-client/src/jvmMain/kotlin/com/sphereon/oid/fed/client/fetch/Fetch.jvm.kt index 349438a4..a84dcb73 100644 --- a/modules/openid-federation-client/src/jvmMain/kotlin/com/sphereon/oid/fed/client/fetch/Fetch.jvm.kt +++ b/modules/openid-federation-client/src/jvmMain/kotlin/com/sphereon/oid/fed/client/fetch/Fetch.jvm.kt @@ -21,7 +21,6 @@ class DefaultFetchJvmImpl : IFetchCallbackService { return getHttpClient().get(endpoint) { headers { append(HttpHeaders.Accept, "application/entity-statement+jwt") - append(HttpHeaders.AcceptCharset, "iso-8859-1, us-ascii, utf-8") } }.body() as String }