Skip to content

Commit

Permalink
add JSONDecodeError
Browse files Browse the repository at this point in the history
  • Loading branch information
rodolfomiranda committed May 2, 2024
1 parent 90c5432 commit 36fa77f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/keria/app/credentialing.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ def on_post(self, req, rep, name):
anc = serdering.SerderKERI(sad=httping.getRequiredParam(body, "ixn"))
else:
anc = serdering.SerderKERI(sad=httping.getRequiredParam(body, "rot"))
except kering.ValidationError as e:
except (kering.ValidationError, json.decoder.JSONDecodeError) as e:
rep.status = falcon.HTTP_400
rep.text = e.args[0]
return
Expand Down
8 changes: 3 additions & 5 deletions tests/app/test_credentialing.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,6 @@ def test_issue_credential(helpers, seeder):
assert result.json == {'description': "name is not a valid reference to an identifier",
'title': '404 Not Found'}

result = client.simulate_post(path="/identifiers/issuer/credentials", body=json.dumps({}).encode("utf-8"))
assert result.status_code == 400
assert result.json == {'description': "required field 'acdc' missing from request",
'title': '400 Bad Request'}

result = client.simulate_post(path="/identifiers/issuer/credentials", body=json.dumps(body).encode("utf-8"))
op = result.json

Expand All @@ -309,6 +304,9 @@ def test_issue_credential(helpers, seeder):

assert agent.credentialer.complete(creder.said) is True

body["acdc"]["a"]["LEI"] = "ACDC10JSON000197_"
result = client.simulate_post(path="/identifiers/issuer/credentials", body=json.dumps(body).encode("utf-8"))
assert result.status_code == 400

def test_credentialing_ends(helpers, seeder):
salt = b'0123456789abcdef'
Expand Down

0 comments on commit 36fa77f

Please sign in to comment.