taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

commit 5b2bf9f0fc4487d3801722b649cf7cb854074132
parent 4544f2dbf3386b6a39c082ca63bd6059b37edae1
Author: Iván Ávalos <avalos@disroot.org>
Date:   Mon,  9 Sep 2024 18:15:10 +0200

[wallet] fix header parsing

bug 0009158

Diffstat:
Mwallet/src/main/java/net/taler/wallet/backend/NetworkInterface.kt | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/wallet/src/main/java/net/taler/wallet/backend/NetworkInterface.kt b/wallet/src/main/java/net/taler/wallet/backend/NetworkInterface.kt @@ -24,7 +24,7 @@ import io.ktor.client.request.headers import io.ktor.client.request.request import io.ktor.client.request.setBody import io.ktor.client.request.url -import io.ktor.util.toMap +import io.ktor.util.flattenForEach import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.Job @@ -93,16 +93,17 @@ class NetworkInterface: Networking.RequestHandler { // HTTP response status code or 0 on error. val status = if (resp?.status?.value != null) resp.status.value else 0 + val headers = mutableListOf<String>().apply { + resp?.headers?.flattenForEach { k, v -> add("$k: $v") } + }.toTypedArray() + Log.d(TAG, "Sending response to wallet-core") sendResponse( Networking.ResponseInfo( requestId = id, status = status, errorMsg = errorMsg, - headers = resp?.headers?.toMap() - ?.map { (k, v) -> "$k: $v" } - ?.toTypedArray() - ?: emptyArray(), + headers = headers, body = resp?.body(), ) )