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 9a7c0c41..f5954272 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 @@ -36,11 +36,16 @@ import io.ktor.http.contentType import io.ktor.http.isSuccess import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObject +import kotlinx.serialization.json.encodeToJsonElement internal class UploadRequest(json: Json, httpClient: HttpClient) : BaseRequest(json, httpClient) { suspend fun initUpload(initUploadBody: InitUploadBody): InitUploadResponseApi { - return post(url = createUrl(ApiRoutes.initUpload), initUploadBody) + val nullableJson = Json(json) { + explicitNulls = false + } + val encodedInitUploadBody = nullableJson.encodeToJsonElement(initUploadBody) + return post(url = createUrl(ApiRoutes.initUpload), encodedInitUploadBody) } suspend fun verifyEmailCode(verifyEmailCodeBody: VerifyEmailCodeBody): AuthorEmailToken {