gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] 06/06: make systemID nullable + catch != 200 responses (nexus


From: gnunet
Subject: [libeufin] 06/06: make systemID nullable + catch != 200 responses (nexus)
Date: Wed, 06 Nov 2019 11:02:50 +0100

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

marcello pushed a commit to branch master
in repository libeufin.

commit c98ef14e575b971fde2c762aa88524ac6053ce73
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Nov 5 23:31:43 2019 +0100

    make systemID nullable + catch != 200 responses (nexus)
---
 nexus/src/main/kotlin/DB.kt   |  2 +-
 nexus/src/main/kotlin/Main.kt | 31 ++++++++++++++++++++++++-------
 2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/nexus/src/main/kotlin/DB.kt b/nexus/src/main/kotlin/DB.kt
index b567c5d..ac61792 100644
--- a/nexus/src/main/kotlin/DB.kt
+++ b/nexus/src/main/kotlin/DB.kt
@@ -13,7 +13,7 @@ object EbicsSubscribersTable: IntIdTable() {
     val hostID = text("hostID")
     val partnerID = text("partnerID")
     val userID = text("userID")
-    val systemID = text("systemID")
+    val systemID = text("systemID").nullable()
     val signaturePrivateKey = blob("signaturePrivateKey")
     val encryptionPrivateKey = blob("encryptionPrivateKey")
     val authenticationPrivateKey = blob("authenticationPrivateKey")
diff --git a/nexus/src/main/kotlin/Main.kt b/nexus/src/main/kotlin/Main.kt
index 267cb30..c6bdd27 100644
--- a/nexus/src/main/kotlin/Main.kt
+++ b/nexus/src/main/kotlin/Main.kt
@@ -66,7 +66,6 @@ fun testData() {
             ebicsURL = "http://localhost:5000/ebicsweb";
             userID = "USER1"
             partnerID = "PARTNER1"
-            systemID = "SYSTEM1"
             hostID = "host01"
 
             signaturePrivateKey = SerialBlob(pairA.private.encoded)
@@ -224,12 +223,30 @@ fun main() {
                 }
 
                 logger.info("POSTing to ${url}")
-                val response = client.post<EbicsKeyManagementResponse>(
-                    urlString = url,
-                    block = {
-                        body = XMLUtil.convertJaxbToString(iniRequest)
-                    }
-                )
+
+                val response = try {
+                    client.post<String>(
+                        urlString = url,
+                        block = {
+                            body = XMLUtil.convertJaxbToString(iniRequest)
+                        }
+                    )
+                } catch (e: Exception) {
+                    e.printStackTrace()
+
+                    call.respond(
+                        HttpStatusCode.OK,
+                        NexusError("Exception thrown by HTTP client (likely 
server responded != 200).")
+                    )
+                    return@post
+                }
+
+                /**
+                 * TODO: check response status code,
+                 * and act accordingly when it differs from 200.
+                 */
+
+                // works: val responseJaxb = 
XMLUtil.convertStringToJaxb<EbicsKeyManagementResponse>(response)
 
                 call.respond(
                     HttpStatusCode.OK,

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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