From b4c7e4d4b7a34a4ec69633a8690785b3ba4aec5b Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 11 Dec 2018 12:33:33 +0100 Subject: [PATCH] don't parse second response --- webtask-mailchimp.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/webtask-mailchimp.js b/webtask-mailchimp.js index a292eaa..59fd0ed 100644 --- a/webtask-mailchimp.js +++ b/webtask-mailchimp.js @@ -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" }') }) })