This commit is contained in:
InsanusMokrassar 2020-08-31 00:40:58 +06:00
parent 4cc4d3d4ec
commit 617ac31ca1
2 changed files with 9 additions and 8 deletions

View File

@ -55,7 +55,7 @@ fun <T> ApplicationCall.decodeUrlQueryValue(
)
}
fun <T> ApplicationCall.decodeUrlQueryValueOrSendError(
suspend fun <T> ApplicationCall.decodeUrlQueryValueOrSendError(
field: String,
deserializer: DeserializationStrategy<T>
) = decodeUrlQueryValue(field, deserializer).also {

View File

@ -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<Key, Value> (
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<Key, Value> (
baseUrl,
keysRoute,
mapOf(
reversedParameterName to reversed.toHex(Boolean.serializer())
reversedParameterName to Boolean.serializer().encodeUrlQueryValue(reversed)
) + pagination.asUrlQueryParts
),
paginationKeyResultSerializer
@ -46,7 +47,7 @@ class KtorOneToManyReadKeyValueRepo<Key, Value> (
buildStandardUrl(
baseUrl,
containsByKeyRoute,
mapOf(keyParameterName to k.toHex(keySerializer))
mapOf(keyParameterName to keySerializer.encodeUrlQueryValue(k))
),
Boolean.serializer()
)
@ -56,8 +57,8 @@ class KtorOneToManyReadKeyValueRepo<Key, Value> (
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<Key, Value> (
baseUrl,
countByKeyRoute,
mapOf(
keyParameterName to k.toHex(keySerializer)
keyParameterName to keySerializer.encodeUrlQueryValue(k)
)
),
Long.serializer()