fix(core): update
This commit is contained in:
26
test/test.ts
26
test/test.ts
@ -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');
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user