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;