From 8464e506e0fafe96e9123342b729f3a76adf9e47 Mon Sep 17 00:00:00 2001 From: sabhas Date: Wed, 18 Aug 2021 00:04:30 +0500 Subject: [PATCH] fix: check for valid json while parsing sas viya debug response --- src/FileUploader.ts | 4 +--- src/utils/parseViyaDebugResponse.ts | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/FileUploader.ts b/src/FileUploader.ts index 4e117df..38d2f52 100644 --- a/src/FileUploader.ts +++ b/src/FileUploader.ts @@ -75,9 +75,7 @@ export class FileUploader { this.requestClient, this.sasjsConfig.serverUrl ) - return typeof jsonResponse === 'string' - ? getValidJson(jsonResponse) - : jsonResponse + return jsonResponse } return typeof res.result === 'string' diff --git a/src/utils/parseViyaDebugResponse.ts b/src/utils/parseViyaDebugResponse.ts index 3137995..b0227f2 100644 --- a/src/utils/parseViyaDebugResponse.ts +++ b/src/utils/parseViyaDebugResponse.ts @@ -1,4 +1,5 @@ import { RequestClient } from '../request/RequestClient' +import { getValidJson } from '../utils' /** * When querying a Viya job using the Web approach (as opposed to using the APIs) with _DEBUG enabled, @@ -25,5 +26,5 @@ export const parseSasViyaDebugResponse = async ( return requestClient .get(serverUrl + jsonUrl, undefined) - .then((res) => res.result) + .then((res: any) => getValidJson(res.result)) }