gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: TWG: empty body when 204.


From: gnunet
Subject: [libeufin] branch master updated: TWG: empty body when 204.
Date: Fri, 13 Jan 2023 16:34:06 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 0676e259 TWG: empty body when 204.
0676e259 is described below

commit 0676e25980a8bc6f93c8fef14d94280888167f39
Author: MS <ms@taler.net>
AuthorDate: Fri Jan 13 16:33:24 2023 +0100

    TWG: empty body when 204.
---
 nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt | 30 +++++++++++++---------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
index eae01b42..66efe910 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
@@ -28,8 +28,7 @@ import io.ktor.client.request.*
 import io.ktor.content.TextContent
 import io.ktor.http.*
 import io.ktor.server.request.receive
-import io.ktor.server.response.respond
-import io.ktor.server.response.respondText
+import io.ktor.server.response.*
 import io.ktor.server.routing.Route
 import io.ktor.server.routing.get
 import io.ktor.server.routing.post
@@ -424,11 +423,15 @@ private suspend fun historyOutgoing(call: 
ApplicationCall) {
             }
         }
     }
-    val responseCode = if (history.outgoing_transactions.size == 0)
-        HttpStatusCode.NoContent else
-        HttpStatusCode.OK
+    if (history.outgoing_transactions.size == 0) {
+        call.respondBytes(
+            bytes = ByteArray(0),
+            status = HttpStatusCode.NoContent
+        )
+        return
+    }
     call.respond(
-        status = responseCode,
+        status = HttpStatusCode.OK,
         TextContent(customConverter(history), ContentType.Application.Json)
     )
 }
@@ -472,13 +475,16 @@ private suspend fun historyIncoming(call: 
ApplicationCall) {
             }
         }
     }
-    val responseCode = if (history.incoming_transactions.size == 0)
-        HttpStatusCode.NoContent else
-            HttpStatusCode.OK
+    if (history.incoming_transactions.size == 0) {
+        call.respondBytes(
+            bytes = ByteArray(0),
+            status = HttpStatusCode.NoContent
+        )
+        return
+    }
     return call.respond(
-        status = responseCode,
-        TextContent(customConverter(history),
-            ContentType.Application.Json)
+        status = HttpStatusCode.OK,
+        TextContent(customConverter(history), ContentType.Application.Json)
     )
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]