Fix flaky tests (#3724)

* adds continuation to silence rejected promises

* Wrap json parsing
This commit is contained in:
Florent Vilmart
2017-04-16 16:50:03 -04:00
committed by GitHub
parent dcd8e5626a
commit 5813fd0bf8
12 changed files with 63 additions and 14 deletions

View File

@@ -36,7 +36,11 @@ function request(path, access_token) {
data += chunk;
});
res.on('end', function() {
data = JSON.parse(data);
try {
data = JSON.parse(data);
} catch(e) {
return reject(e);
}
resolve(data);
});
}).on('error', function() {