From 1f4a254ec5449e2e04797ce3fa904cf14048ccde Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 15 Feb 2024 15:47:56 +0000 Subject: [PATCH] Fix for integration test, make sure to carry auth headers over correctly. --- packages/server/src/utilities/workerRequests.ts | 9 +++++++++ packages/shared-core/src/constants/api.ts | 1 + 2 files changed, 10 insertions(+) diff --git a/packages/server/src/utilities/workerRequests.ts b/packages/server/src/utilities/workerRequests.ts index 5612084216..b5c3bfcd4a 100644 --- a/packages/server/src/utilities/workerRequests.ts +++ b/packages/server/src/utilities/workerRequests.ts @@ -7,6 +7,7 @@ import { tenancy, logging, env as coreEnv, + utils, } from "@budibase/backend-core" import { Ctx, User, EmailInvite } from "@budibase/types" @@ -25,6 +26,14 @@ export function request(ctx?: Ctx, request?: any) { request.headers[header] = ctx.headers[header] } } + // be specific about auth headers + const cookie = ctx.headers[constants.Header.COOKIE], + apiKey = ctx.headers[constants.Header.API_KEY] + if (cookie) { + request.headers[constants.Header.COOKIE] = cookie + } else if (apiKey) { + request.headers[constants.Header.API_KEY] = apiKey + } } // apply tenancy if its available diff --git a/packages/shared-core/src/constants/api.ts b/packages/shared-core/src/constants/api.ts index d6633649e6..f63849bf3d 100644 --- a/packages/shared-core/src/constants/api.ts +++ b/packages/shared-core/src/constants/api.ts @@ -16,4 +16,5 @@ export enum Header { CORRELATION_ID = "x-budibase-correlation-id", AUTHORIZATION = "authorization", MIGRATING_APP = "x-budibase-migrating-app", + COOKIE = "cookie", }