mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-16 08:30:07 +00:00
fix: parse empty string in res to empty {}
This commit is contained in:
@@ -12,6 +12,8 @@ export const getValidJson = (str: string | object): object => {
|
|||||||
|
|
||||||
if (typeof str === 'object') return str
|
if (typeof str === 'object') return str
|
||||||
|
|
||||||
|
if (str === '') return {}
|
||||||
|
|
||||||
return JSON.parse(str)
|
return JSON.parse(str)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof JsonParseArrayError) throw e
|
if (e instanceof JsonParseArrayError) throw e
|
||||||
|
|||||||
Reference in New Issue
Block a user