0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(core): fix the post domains api error status code (#5552)

fix the post domains api error status code
This commit is contained in:
simeng-li 2024-03-25 18:18:36 +08:00 committed by GitHub
parent 62bd784d4e
commit a9b927910d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,7 +60,7 @@ export default function domainRoutes<T extends AuthedRouter>(
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<T extends AuthedRouter>(
})
);
// Throw 400 error if domain is invalid
const syncedDomain = await addDomain(ctx.guard.body.domain);
ctx.status = 201;