1
0
Fork 0
mirror of synced 2024-06-27 18:40:42 +12:00

Fix for tests when headers are undefined

This commit is contained in:
Andrew Kingston 2022-04-06 14:11:05 +01:00
parent 4f212397b0
commit caff2d7508

View file

@ -68,7 +68,7 @@ module.exports = async (ctx, next) => {
const isBuilder =
globalUser && globalUser.builder && globalUser.builder.global
const isDevApp = appId && isDevAppID(appId)
const roleHeader = ctx.request.headers[Headers.PREVIEW_ROLE]
const roleHeader = ctx.request && ctx.request.headers[Headers.PREVIEW_ROLE]
if (isBuilder && isDevApp && roleHeader) {
// Ensure the role is valid by ensuring a definition exists
try {