From b40b9847b6283ae0aed04a8dcde76c9ea7771647 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Fri, 6 Dec 2024 10:37:04 +0100 Subject: [PATCH 1/2] fix: Cancel an upload with a json body --- .../network/requests/UploadRequest.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt index d378ac12..5c87be63 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt @@ -31,6 +31,8 @@ import io.ktor.client.HttpClient import io.ktor.client.plugins.onUpload import io.ktor.client.request.post import io.ktor.client.request.setBody +import io.ktor.http.ContentType +import io.ktor.http.contentType import io.ktor.http.isSuccess import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObject @@ -77,6 +79,7 @@ internal class UploadRequest(json: Json, httpClient: HttpClient) : BaseRequest(j suspend fun cancelUpload(jsonBody: JsonObject): Boolean { val httpResponse = httpClient.post(url = createUrl(ApiRoutes.cancelUpload)) { + contentType(ContentType.Application.Json) setBody(jsonBody) } return httpResponse.status.isSuccess() From 02a4d1f1ea5d67511cc0cfbe236af9f676e9b223 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Fri, 6 Dec 2024 10:37:29 +0100 Subject: [PATCH 2/2] fix: Resend email code with json body --- .../network/requests/UploadRequest.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt index 5c87be63..9a7c0c41 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt @@ -49,6 +49,7 @@ internal class UploadRequest(json: Json, httpClient: HttpClient) : BaseRequest(j suspend fun resendEmailCode(resendEmailCodeBody: ResendEmailCodeBody): Boolean { val httpResponse = httpClient.post(url = createUrl(ApiRoutes.resendEmailCode)) { + contentType(ContentType.Application.Json) setBody(resendEmailCodeBody) } return httpResponse.status.isSuccess()