mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -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:
parent
62bd784d4e
commit
a9b927910d
1 changed files with 2 additions and 1 deletions
|
@ -60,7 +60,7 @@ export default function domainRoutes<T extends AuthedRouter>(
|
||||||
koaGuard({
|
koaGuard({
|
||||||
body: Domains.createGuard.pick({ domain: true }),
|
body: Domains.createGuard.pick({ domain: true }),
|
||||||
response: domainResponseGuard,
|
response: domainResponseGuard,
|
||||||
status: [201, 422],
|
status: [201, 422, 400],
|
||||||
}),
|
}),
|
||||||
async (ctx, next) => {
|
async (ctx, next) => {
|
||||||
const existingDomains = await findAllDomains();
|
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);
|
const syncedDomain = await addDomain(ctx.guard.body.domain);
|
||||||
|
|
||||||
ctx.status = 201;
|
ctx.status = 201;
|
||||||
|
|
Loading…
Reference in a new issue