fix(requests): omit JSON based(without encryption) data

This commit is contained in:
greenhat616
2021-05-24 02:00:34 +08:00
parent 97bd7fedf8
commit e0eec75f08
2 changed files with 5506 additions and 7 deletions
+7 -1
View File
@@ -172,7 +172,13 @@ const createRequest = (method, url, data, options) => {
}
} catch (e) {
// console.log(e)
answer.body = body
try {
answer.body = JSON.parse(body.toString())
} catch (err) {
// console.log(err)
// can't decrypt and can't parse directly
answer.body = body
}
answer.status = res.status
}