Skip to content

Commit

Permalink
Fix type error in test plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin committed Dec 4, 2023
1 parent d762cea commit 70fb07a
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -116,9 +116,14 @@ export function initRoutes(
},
async (context, request, response) => {
const [, { security }] = await core.getStartServices();
return response.ok({
body: await security.authc.apiKeys.grantAsInternalUser(request, request.body),
});
const apiKey = await security.authc.apiKeys.grantAsInternalUser(request, request.body);
if (!apiKey) {
throw new Error(
`Couldn't generate API key with the following parameters: ${JSON.stringify(request.body)}`
);
}

return response.ok({ body: apiKey });
}
);

Expand Down

0 comments on commit 70fb07a

Please sign in to comment.