1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-10 17:04:36 +00:00

fix: invalid json checking

This commit is contained in:
2021-07-09 13:36:12 +02:00
parent a00cb1ebec
commit 46f5e07f11
2 changed files with 41 additions and 14733 deletions

14773
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,7 @@
*/
export const isValidJson = (str: string) => {
try {
str = typeof str !== 'string' ? JSON.stringify(str) : str
JSON.parse(str)
} catch (e) {
throw new Error('Invalid JSON response.')