From 5192fb19be41c4b453447080c4386dfc3b2aa10c Mon Sep 17 00:00:00 2001 From: Arham Jain Date: Mon, 17 Jun 2024 13:56:59 +0530 Subject: [PATCH] refactor: add transformResponse function for safe JSON parsing --- src/class/DataSync.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/class/DataSync.ts b/src/class/DataSync.ts index 38748c3..f0645b2 100644 --- a/src/class/DataSync.ts +++ b/src/class/DataSync.ts @@ -65,6 +65,9 @@ export const queryFromDistributor = async (type: DataType, queryParameters: any) 'Content-Type': 'application/json', }, timeout: 30000, + transformResponse: (res) => { + return StringUtils.safeJsonParse(res) + }, }) return response } catch (e) {