Skip to content

Commit 1e9444f

Browse files
authored
Merge pull request #46 from AlexandrouR/fixEnclave
Fix downstream compile errors from okhttp update
2 parents f61d364 + 4b4f151 commit 1e9444f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/kotlin/org/web3j/quorum/enclave/protocol/EnclaveService.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ package org.web3j.quorum.enclave.protocol
1414

1515
import com.fasterxml.jackson.annotation.JsonInclude
1616
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
17-
import okhttp3.MediaType
17+
import okhttp3.MediaType.Companion.toMediaTypeOrNull
1818
import okhttp3.OkHttpClient
1919
import okhttp3.Request
2020
import okhttp3.RequestBody
@@ -28,7 +28,7 @@ class EnclaveService(private val url: String, private val port: Int, private val
2828

2929
private val objectMapper = jacksonObjectMapper()
3030
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
31-
private val JSON_MEDIA_TYPE = MediaType.parse("application/json; charset=utf-8")
31+
private val JSON_MEDIA_TYPE = "application/json; charset=utf-8".toMediaTypeOrNull()
3232

3333
/**
3434
* Send a new raw payload to Enclave
@@ -45,11 +45,11 @@ class EnclaveService(private val url: String, private val port: Int, private val
4545
val response = client.newCall(buildRequest).execute()
4646

4747
if (response.isSuccessful) {
48-
val chunk = response.body()?.string()
48+
val chunk = response.body?.string()
4949
return objectMapper.readValue(chunk, responseType)
5050
} else {
51-
val statusCode = response.code()
52-
val text = if (response.body() == null) "N/A" else response.body()?.string()
51+
val statusCode = response.code
52+
val text = if (response.body == null) "N/A" else response.body?.string()
5353

5454
throw EnclaveClientConnectionException("Invalid response received from enclave: $statusCode $text")
5555
}
@@ -65,6 +65,6 @@ class EnclaveService(private val url: String, private val port: Int, private val
6565
.get()
6666
.build()
6767
val response = client.newCall(request).execute()
68-
return response.body()?.string() ?: ""
68+
return response.body?.string() ?: ""
6969
}
7070
}

0 commit comments

Comments
 (0)