gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: testing malformed JSON handling


From: gnunet
Subject: [libeufin] branch master updated: testing malformed JSON handling
Date: Wed, 27 Jan 2021 16:08:45 +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 3883732  testing malformed JSON handling
3883732 is described below

commit 3883732379d0dc00658f186145d6c4cf834a5d21
Author: MS <ms@taler.net>
AuthorDate: Wed Jan 27 16:08:39 2021 +0100

    testing malformed JSON handling
---
 integration-tests/tests.py                           | 20 +++++++++++++++++++-
 .../kotlin/tech/libeufin/nexus/server/NexusServer.kt |  1 -
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index cbc281e..40ccb07 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -511,7 +511,7 @@ def test_sandbox_camt():
 
     assertResponse(
         post(
-            f"{PERSONA.banking.bank_base_url}/admin/payments/camt",
+            f"{persona.Banking.bank_base_url}/admin/payments/camt",
             json=dict(iban="GB33BUKB20201555555555", type=53)
         )
     )
@@ -566,3 +566,21 @@ def test_schedule_deletion():
         ),
         acceptedResponses=[404]
     )
+
+def test_invalid_json():
+    assertResponse(
+        post(
+            f"{PERSONA.nexus.base_url}/users",
+            data="malformed",
+            headers={"Content-Type": "application/json"},
+            auth=auth.HTTPBasicAuth("admin", "x")),
+        acceptedResponses=[400]
+    )
+    assertResponse(
+        post(
+            f"{PERSONA.banking.bank_base_url}/admin/ebics/hosts",
+            data="malformed",
+            headers={"Content-Type": "application/json"},
+            auth=auth.HTTPBasicAuth("admin", "x")),
+        acceptedResponses=[400]
+    )
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
index d8da5fb..fc08971 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -138,7 +138,6 @@ suspend inline fun <reified T : Any> 
ApplicationCall.receiveJson(): T {
     } catch (e: MissingKotlinParameterException) {
         throw NexusError(HttpStatusCode.BadRequest, "Missing value for 
${e.pathReference}")
     } catch (e: MismatchedInputException) {
-        // Note: POSTing "[]" gets here but e.pathReference is blank.
         throw NexusError(HttpStatusCode.BadRequest, "Invalid value for 
'${e.pathReference}'")
     } catch (e: JsonParseException) {
         throw NexusError(HttpStatusCode.BadRequest, "Invalid 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]