gmailnator
Advanced tools
Comparing version 1.1.6 to 1.1.7
17
index.js
@@ -170,8 +170,15 @@ const got = require("got"); | ||
}).then(function(response) { | ||
if (response.body.split("<hr />")[1] !== undefined) { | ||
var body = response.body.split("<hr />")[1]; | ||
cb(null, body); | ||
var json = JSON.parse(response.body); | ||
if (json !== null) { | ||
if (json.content) {cb(null, json.content);} else { | ||
cb({ | ||
"code": "couldNotParse", | ||
"message": "We could not parse your email." | ||
}, null); | ||
} | ||
} else { | ||
var body = ""; | ||
cb(null, body); | ||
cb({ | ||
"code": "couldNotParse", | ||
"message": "We could not parse your email." | ||
}, null); | ||
} | ||
@@ -178,0 +185,0 @@ }).catch(function(e) { |
{ | ||
"name": "gmailnator", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "access gmailnator.com programically", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
12209
263