From 64a01f18d862fdf67f4b11545d21adbcb048404b Mon Sep 17 00:00:00 2001 From: Darcy Ye Date: Fri, 28 Apr 2023 11:12:57 +0800 Subject: [PATCH] chore(test): add SIE API guard (#3774) --- .../core/src/routes/sign-in-experience/index.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/core/src/routes/sign-in-experience/index.ts b/packages/core/src/routes/sign-in-experience/index.ts index b731b07de..a7cdbfb21 100644 --- a/packages/core/src/routes/sign-in-experience/index.ts +++ b/packages/core/src/routes/sign-in-experience/index.ts @@ -21,11 +21,18 @@ export default function signInExperiencesRoutes( * As we only support single signInExperience settings for V1 * always return the default settings in DB for the /sign-in-exp get method */ - router.get('/sign-in-exp', async (ctx, next) => { - ctx.body = await findDefaultSignInExperience(); + router.get( + '/sign-in-exp', + koaGuard({ + response: SignInExperiences.guard, + status: [200], + }), + async (ctx, next) => { + ctx.body = await findDefaultSignInExperience(); - return next(); - }); + return next(); + } + ); router.patch( '/sign-in-exp', @@ -40,6 +47,8 @@ export default function signInExperiencesRoutes( }) ) .partial(), + response: SignInExperiences.guard, + status: [200], }), async (ctx, next) => { const {