From 35bbccec67635bbe64eee482119400ae721929bd Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 23 Jul 2024 11:59:14 +0200 Subject: [PATCH] Return 400 instead of 403 --- packages/server/src/api/controllers/automation.ts | 2 +- packages/server/src/api/routes/tests/automation.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/automation.ts b/packages/server/src/api/controllers/automation.ts index 2e7914f60b..35799e5dee 100644 --- a/packages/server/src/api/controllers/automation.ts +++ b/packages/server/src/api/controllers/automation.ts @@ -99,7 +99,7 @@ export async function destroy(ctx: UserCtx) { if ( automation.definition.trigger.stepId === AutomationTriggerStepId.ROW_ACTION ) { - ctx.throw("Row actions cannot be deleted", 403) + ctx.throw("Row actions cannot be deleted", 400) } ctx.body = await sdk.automations.remove(automationId, ctx.params.rev) diff --git a/packages/server/src/api/routes/tests/automation.spec.ts b/packages/server/src/api/routes/tests/automation.spec.ts index a82bc68465..8fccb32299 100644 --- a/packages/server/src/api/routes/tests/automation.spec.ts +++ b/packages/server/src/api/routes/tests/automation.spec.ts @@ -433,7 +433,7 @@ describe("/automations", () => { .delete(`/api/automations/${automation._id}/${automation._rev}`) .set(config.defaultHeaders()) .expect("Content-Type", /json/) - .expect(403, { message: "Row actions cannot be deleted", status: 403 }) + .expect(400, { message: "Row actions cannot be deleted", status: 400 }) expect(events.automation.deleted).not.toHaveBeenCalled() })