Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Nov 5, 2024
1 parent c79dcb7 commit 8663d94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -94,12 +91,13 @@ class DefaultFetchJSImpl : IFetchCallbackServiceJS {

override fun fetchStatement(endpoint: String): Promise<String> {
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()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 8663d94

Please sign in to comment.