From 617ac31ca11e15312bff1a4f3c3c7198bd45fc22 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 31 Aug 2020 00:40:58 +0600 Subject: [PATCH] hotfix --- .../ktor/server/ServerRoutingShortcuts.kt | 2 +- .../one_to_many/KtorOneToManyReadKeyValueRepo.kt | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ktor/server/src/jvmMain/kotlin/com/insanusmokrassar/postssystem/ktor/server/ServerRoutingShortcuts.kt b/ktor/server/src/jvmMain/kotlin/com/insanusmokrassar/postssystem/ktor/server/ServerRoutingShortcuts.kt index 7aacd5af..88bae92b 100644 --- a/ktor/server/src/jvmMain/kotlin/com/insanusmokrassar/postssystem/ktor/server/ServerRoutingShortcuts.kt +++ b/ktor/server/src/jvmMain/kotlin/com/insanusmokrassar/postssystem/ktor/server/ServerRoutingShortcuts.kt @@ -55,7 +55,7 @@ fun ApplicationCall.decodeUrlQueryValue( ) } -fun ApplicationCall.decodeUrlQueryValueOrSendError( +suspend fun ApplicationCall.decodeUrlQueryValueOrSendError( field: String, deserializer: DeserializationStrategy ) = decodeUrlQueryValue(field, deserializer).also { diff --git a/utils/repos/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/client/one_to_many/KtorOneToManyReadKeyValueRepo.kt b/utils/repos/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/client/one_to_many/KtorOneToManyReadKeyValueRepo.kt index 0df572fa..e0736e40 100644 --- a/utils/repos/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/client/one_to_many/KtorOneToManyReadKeyValueRepo.kt +++ b/utils/repos/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/client/one_to_many/KtorOneToManyReadKeyValueRepo.kt @@ -1,6 +1,7 @@ package com.insanusmokrassar.postssystem.utils.repos.ktor.client.one_to_many import com.insanusmokrassar.postssystem.ktor.* +import com.insanusmokrassar.postssystem.ktor.client.encodeUrlQueryValue import com.insanusmokrassar.postssystem.ktor.client.uniget import com.insanusmokrassar.postssystem.utils.common.pagination.Pagination import com.insanusmokrassar.postssystem.utils.common.pagination.PaginationResult @@ -24,8 +25,8 @@ class KtorOneToManyReadKeyValueRepo ( baseUrl, getRoute, mapOf( - keyParameterName to k.toHex(keySerializer), - reversedParameterName to reversed.toHex(Boolean.serializer()) + keyParameterName to keySerializer.encodeUrlQueryValue(k), + reversedParameterName to Boolean.serializer().encodeUrlQueryValue(reversed) ) + pagination.asUrlQueryParts ), paginationValueResultSerializer @@ -36,7 +37,7 @@ class KtorOneToManyReadKeyValueRepo ( baseUrl, keysRoute, mapOf( - reversedParameterName to reversed.toHex(Boolean.serializer()) + reversedParameterName to Boolean.serializer().encodeUrlQueryValue(reversed) ) + pagination.asUrlQueryParts ), paginationKeyResultSerializer @@ -46,7 +47,7 @@ class KtorOneToManyReadKeyValueRepo ( buildStandardUrl( baseUrl, containsByKeyRoute, - mapOf(keyParameterName to k.toHex(keySerializer)) + mapOf(keyParameterName to keySerializer.encodeUrlQueryValue(k)) ), Boolean.serializer() ) @@ -56,8 +57,8 @@ class KtorOneToManyReadKeyValueRepo ( baseUrl, containsByKeyValueRoute, mapOf( - keyParameterName to k.toHex(keySerializer), - valueParameterName to v.toHex(valueSerializer), + keyParameterName to keySerializer.encodeUrlQueryValue(k), + valueParameterName to valueSerializer.encodeUrlQueryValue(v), ) ), Boolean.serializer() @@ -68,7 +69,7 @@ class KtorOneToManyReadKeyValueRepo ( baseUrl, countByKeyRoute, mapOf( - keyParameterName to k.toHex(keySerializer) + keyParameterName to keySerializer.encodeUrlQueryValue(k) ) ), Long.serializer()