- res.setHeader('Content-Type', 'text/plain');
- res.setHeader('WWW-Authenticate', 'Basic realm=users');
- res.writeHead(StatusCodes.UNAUTHORIZED);
- res.end(`${StatusCodes.UNAUTHORIZED} Unauthorized`);
+ res
+ .writeHead(StatusCodes.UNAUTHORIZED, {
+ 'Content-Type': 'text/plain',
+ 'WWW-Authenticate': 'Basic realm=users',
+ })
+ .end(`${StatusCodes.UNAUTHORIZED} Unauthorized`)
+ .destroy();