From a9b927910d6549a2f2c86cacd65bbe01baca2e7d Mon Sep 17 00:00:00 2001 From: simeng-li Date: Mon, 25 Mar 2024 18:18:36 +0800 Subject: [PATCH] fix(core): fix the post domains api error status code (#5552) fix the post domains api error status code --- packages/core/src/routes/domain.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/routes/domain.ts b/packages/core/src/routes/domain.ts index 815e75448..475920c2d 100644 --- a/packages/core/src/routes/domain.ts +++ b/packages/core/src/routes/domain.ts @@ -60,7 +60,7 @@ export default function domainRoutes( koaGuard({ body: Domains.createGuard.pick({ domain: true }), response: domainResponseGuard, - status: [201, 422], + status: [201, 422, 400], }), async (ctx, next) => { const existingDomains = await findAllDomains(); @@ -72,6 +72,7 @@ export default function domainRoutes( }) ); + // Throw 400 error if domain is invalid const syncedDomain = await addDomain(ctx.guard.body.domain); ctx.status = 201;