MCPcopy
hub / github.com/nestjs/nest / AuthMiddleware

Class AuthMiddleware

integration/hello-world/e2e/middleware-fastify.spec.ts:28–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26
27 describe('trailing slash handling', () => {
28 @Injectable()
29 class AuthMiddleware implements NestMiddleware {
30 use(
31 req: FastifyRequest['raw'] & { headers: Record<string, unknown> },
32 res,
33 next: () => void,
34 ) {
35 if (req.headers['x-auth'] === '1') {
36 return next();
37 }
38 res.statusCode = 401;
39 res.end('unauthorized');
40 }
41 }
42
43 @Controller('users')
44 class UsersController {

Callers

nothing calls this directly

Calls 1

InjectableFunction · 0.90

Tested by

no test coverage detected