Merge pull request #24 from oceanprotocol/fix/error-response

don't parse second response body
This commit is contained in:
Matthias Kretschmann 2018-12-11 12:38:43 +01:00 committed by GitHub
commit 476ddcfb56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -91,14 +91,12 @@ server.post('/newsletter/:email', (req, res) => {
request.put(optionsCreate, (error2, response, body2) => {
if (error2) res.send(error2)
const data2 = JSON.parse(body2)
if (Number.isInteger(data2.status)) {
if (Number.isInteger(body2.status)) {
res.send(body2)
}
// Patch in native GDPR permissions
addMarketingPermissions(data2, () => {
addMarketingPermissions(body2, () => {
res.send('{ "status": "created" }')
})
})