I'm implementing an API which would be called by different users, I want the user id to be to be provided via a header called "tenant" otherwise if not provided an error message should be thrown.
if (! request.get('Tenant')) {
return res.status(403).json({ error: 'No tenant header sent!' });
}
next();
}, router);
I've tried the above code but it is not restricting access when the tenant header is not sent as part of the request.