feat: automatically 404 if exposeUid or exposeGroupName come up empty

This commit is contained in:
Julian Lam
2023-01-24 21:27:44 -05:00
parent f8eef75daf
commit 839d05bc95

View File

@@ -151,7 +151,12 @@ async function expose(exposedField, method, field, req, res, next) {
if (!req.params.hasOwnProperty(field)) {
return next();
}
res.locals[exposedField] = await method(req.params[field]);
const value = await method(req.params[field]);
if (!value) {
next('route');
}
res.locals[exposedField] = value;
next();
}