Skip to content

Commit 89a9edc

Browse files
committed
fix: deprecation errors following OkHttp upgrade
1 parent ca512a7 commit 89a9edc

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

android/src/main/java/io/deckers/blob_courier/send/BlobSender.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ class BlobSender(
5959

6060
val response = sendRequestCall.execute()
6161

62-
val responseBody = response.body()?.string().orEmpty()
62+
val responseBody = response.body?.string().orEmpty()
6363

6464
li("Finished unmanaged send")
6565

6666
return Success(
6767
mapOf(
6868
"response" to mapOf(
69-
"code" to response.code(),
69+
"code" to response.code,
7070
"data" to if (senderParameters.returnResponse) responseBody else "",
71-
"headers" to mapHeadersToMap(response.headers())
71+
"headers" to mapHeadersToMap(response.headers)
7272
)
7373
)
7474
)
7575
} catch (e: IOException) {
76-
if (sendRequestCall.isCanceled) {
76+
if (sendRequestCall.isCanceled()) {
7777
return Failure(createErrorFromThrowable(ERROR_CANCELED_EXCEPTION, e))
7878
}
7979

android/src/main/java/io/deckers/blob_courier/send/SenderParameterFactory.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ import io.deckers.blob_courier.common.maybe
3232
import io.deckers.blob_courier.common.right
3333
import io.deckers.blob_courier.common.testKeep
3434
import io.deckers.blob_courier.common.validationContext
35-
import io.deckers.blob_courier.upload.FilePayload
36-
import io.deckers.blob_courier.upload.StringPayload
37-
import io.deckers.blob_courier.upload.UploaderParameters
38-
import okhttp3.MediaType
39-
import okhttp3.MultipartBody
35+
import okhttp3.MediaType.Companion.toMediaType
36+
import okhttp3.MediaType.Companion.toMediaTypeOrNull
4037
import okhttp3.RequestBody
4138
import java.net.URL
4239

@@ -61,8 +58,8 @@ data class SenderParameters(
6158

6259
fun SenderParameters.toRequestBody(contentResolver: ContentResolver): RequestBody =
6360
InputStreamRequestBody(
64-
mediaType.let(MediaType::parse)
65-
?: MediaType.get(DEFAULT_MIME_TYPE),
61+
mediaType.toMediaTypeOrNull()
62+
?: DEFAULT_MIME_TYPE.toMediaType(),
6663
contentResolver,
6764
absoluteFilePath
6865
)

0 commit comments

Comments
 (0)