From 9c257f076df172437d4869d97c9dbad6783f0a88 Mon Sep 17 00:00:00 2001 From: shrouti1507 <60211312+shrouti1507@users.noreply.github.com> Date: Fri, 10 Nov 2023 18:39:55 +0530 Subject: [PATCH] Update src/v0/destinations/salesforce/transform.js Co-authored-by: Sankeerth --- src/v0/destinations/salesforce/transform.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/v0/destinations/salesforce/transform.js b/src/v0/destinations/salesforce/transform.js index 4d21d6405d..4038c59ef7 100644 --- a/src/v0/destinations/salesforce/transform.js +++ b/src/v0/destinations/salesforce/transform.js @@ -89,16 +89,12 @@ function responseBuilderSimple( } const response = defaultRequestConfig(); - const finalHeader = - authorizationFlow === 'oauth' - ? { - 'Content-Type': JSON_MIME_TYPE, - Authorization: `Bearer ${authorizationData.token}`, - } - : { - 'Content-Type': JSON_MIME_TYPE, - Authorization: authorizationData.token, - }; + const getAuthHeader = (authInfo) => { + const { authorizationFlow, authorizationData } = authInfo; + return authorizationFlow === 'oauth' + ? { Authorization: `Bearer ${authorizationData.token}` } + : { Authorization: authorizationData.token }; + } response.method = defaultPostRequestConfig.requestMethod; response.headers = finalHeader;