1
0
mirror of https://github.com/oceanprotocol/webtasks synced 2024-06-15 17:03:15 +02:00

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

View File

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