mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-07 04:20:05 +00:00
fix: isValidJson function returns the JSON parsed
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
export const isValidJson = (str: string | object) => {
|
||||
try {
|
||||
if (typeof str === 'object') return
|
||||
if (typeof str === 'object') return str
|
||||
|
||||
str = JSON.parse(str)
|
||||
return JSON.parse(str)
|
||||
} catch (e) {
|
||||
throw new Error('Invalid JSON response.')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user