From 7546c1a8d518c5b9b87f47e167a2f95b419ce0e8 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 6 Apr 2022 14:11:05 +0100 Subject: [PATCH] Fix for tests when headers are undefined --- packages/server/src/middleware/currentapp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/middleware/currentapp.js b/packages/server/src/middleware/currentapp.js index ad59186ebb..8ddf608572 100644 --- a/packages/server/src/middleware/currentapp.js +++ b/packages/server/src/middleware/currentapp.js @@ -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 {