summaryrefslogtreecommitdiff
path: root/platform/node/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-01-07 15:45:01 +0100
committerKonstantin Käfer <mail@kkaefer.com>2016-01-08 13:23:01 +0100
commitc5feadf0bd04d77335f56f79c1dea75a3c43c976 (patch)
tree71349fdc8fba46ce8a7cdcac5fb7e3e580f88dea /platform/node/test
parent7e815aed2e6adb73b3596b450bb85e93ce569e2a (diff)
downloadqtlocation-mapboxgl-c5feadf0bd04d77335f56f79c1dea75a3c43c976.tar.gz
[test] deliver error responses when the underlying request failed
Diffstat (limited to 'platform/node/test')
-rw-r--r--platform/node/test/render.test.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/platform/node/test/render.test.js b/platform/node/test/render.test.js
index a4c6448a16..745652567c 100644
--- a/platform/node/test/render.test.js
+++ b/platform/node/test/render.test.js
@@ -19,7 +19,13 @@ suite.run('native', {tests: tests}, function (style, options, callback) {
ratio: options.pixelRatio,
request: function(req, callback) {
request(req.url, {encoding: null}, function (err, response, body) {
- callback(err, {data: body});
+ if (err) {
+ callback(err);
+ } else if (response.statusCode != 200) {
+ callback(response.statusMessage);
+ } else {
+ callback(null, {data: body});
+ }
});
}
});