From 35cc1e4f620c7426c42800bce84da0e0d2635bdc Mon Sep 17 00:00:00 2001 From: Yury Shkoda Date: Fri, 30 Oct 2020 11:26:43 +0300 Subject: [PATCH] chore(fetchLogFileContent): made accessToken optional --- src/SASjs.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/SASjs.ts b/src/SASjs.ts index c74b564..69c8469 100644 --- a/src/SASjs.ts +++ b/src/SASjs.ts @@ -1269,14 +1269,15 @@ export default class SASjs { * @param logLink - url of the log file. * @param accessToken - an access token for an authorized user. */ - public fetchLogFileContent(logLink: string, accessToken: string) { + public fetchLogFileContent(logLink: string, accessToken?: string) { + const headers: any = { 'Content-Type': 'application/json' } + + if (accessToken) headers.Authorization = 'Bearer ' + accessToken + return new Promise((resolve, reject) => { fetch(logLink, { method: 'GET', - headers: { - 'Content-Type': 'application/json', - Authorization: 'Bearer ' + accessToken - } + headers }) .then((response: any) => response.text()) .then((response: any) => resolve(response))