Graphql: Prevent store response with errors in cache (#16926)

* Prevent cache response with errors

* Fix failing test

* mock env in notifications service test

* Use res.locals.cache = false instead

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
José Varela
2023-01-12 22:06:24 +00:00
committed by GitHub
parent 0f9f0d8fc4
commit 5e555f7756

View File

@@ -18,6 +18,10 @@ router.use(
res.locals.payload = await service.execute(res.locals.graphqlParams);
if (res.locals.payload?.errors?.length > 0) {
res.locals.cache = false;
}
return next();
}),
respond
@@ -35,6 +39,10 @@ router.use(
res.locals.payload = await service.execute(res.locals.graphqlParams);
if (res.locals.payload?.errors?.length > 0) {
res.locals.cache = false;
}
return next();
}),
respond