fix(core): update

This commit is contained in:
2019-08-07 16:34:34 +02:00
parent eb9151e23e
commit 5371bd058a
10 changed files with 72 additions and 31 deletions

View File

@ -19,7 +19,7 @@ tap.test('should be able to create smartguards for a request', async () => {
req: smartexpress.Request;
res: smartexpress.Response;
}
const ipGuard = new smartguard.Guard<IRequestGuardData>(async (dataArg) => {
const ipGuard = new smartguard.Guard<IRequestGuardData>(async dataArg => {
console.log('executing ip guard');
if (dataArg) {
console.log('ip guard succeeded');
@ -30,15 +30,21 @@ tap.test('should be able to create smartguards for a request', async () => {
}
});
smartexpressInstance.addRoute('/testroute', new smartexpress.Handler('ALL', async (req, res) => {
await smartguard.passGuards({
req,
res
}, [ipGuard]);
console.log('ip guard said ok');
res.status(200);
res.send('hi');
}));
smartexpressInstance.addRoute(
'/testroute',
new smartexpress.Handler('ALL', async (req, res) => {
await smartguard.passGuards(
{
req,
res
},
[ipGuard]
);
console.log('ip guard said ok');
res.status(200);
res.send('hi');
})
);
console.log('Got here ok');
});