From 47d91eb699d491f11e29c2e668aec8eb716ba9af Mon Sep 17 00:00:00 2001 From: Timothee Boussus Date: Mon, 6 Apr 2020 23:58:12 +0200 Subject: [PATCH] Fixing 200 HTTP response with empty body --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 4c9eaeb..4314a5b 100644 --- a/index.js +++ b/index.js @@ -211,7 +211,7 @@ function onRequestResponse (options, error, response, body) { function onCloudflareResponse (options, response, body) { const callback = options.callback; - if (body.length < 1) { + if (!(response.statusCode >= 200 && response.statusCode < 300) && body.length < 1) { // This is a 4xx-5xx Cloudflare response with an empty body. return callback(new CloudflareError(response.statusCode, options, response)); }