From b97087c099ea608e22962ac8a26366c59f642934 Mon Sep 17 00:00:00 2001 From: jomo Date: Sun, 20 Sep 2015 19:12:31 +0200 Subject: [PATCH] catch HTTP 500/503 and empty response, fixes #141 --- lib/networking.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/networking.js b/lib/networking.js index 0d728ae..0217d12 100644 --- a/lib/networking.js +++ b/lib/networking.js @@ -91,6 +91,8 @@ exp.get_from_options = function(rid, url, options, callback) { break; case 404: case 204: + case 500: + case 503: // we don't want to cache this body = null; break; @@ -107,6 +109,11 @@ exp.get_from_options = function(rid, url, options, callback) { break; } + if (body && !body.length) { + // empty response + body = null; + } + callback(body, response, error); }); };