Skip to content

Commit

Permalink
feat: return 409 if agent already booted (#302)
Browse files Browse the repository at this point in the history
* fix: 409 instead of 400 response for already booted agent

* test: update boot test for 409
  • Loading branch information
iFergal authored Oct 9, 2024
1 parent a2d9e71 commit 19fa3d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/keria/app/agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,8 @@ def on_post(self, req, rep):
caid = icp.pre

if self.agency.get(caid=caid) is not None:
raise falcon.HTTPBadRequest(title="agent already exists",
description=f"agent for controller {caid} already exists")
raise falcon.HTTPConflict(title="agent already exists",
description=f"agent for controller {caid} already exists")

agent = self.agency.create(caid=caid)

Expand Down
2 changes: 1 addition & 1 deletion tests/app/test_agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def test_boot_ends(helpers):
assert rep.status_code == 202

rep = client.simulate_post("/boot", body=json.dumps(body).encode("utf-8"))
assert rep.status_code == 400
assert rep.status_code == 409
assert rep.json == {
'title': 'agent already exists',
'description': 'agent for controller EK35JRNdfVkO4JwhXaSTdV4qzB_ibk_tGJmSVcY4pZqx already exists'
Expand Down

0 comments on commit 19fa3d3

Please sign in to comment.