From abfd2dc96cfeb7dd018c925f50237c1253ed0f81 Mon Sep 17 00:00:00 2001 From: Charles Fries Date: Wed, 10 Apr 2019 16:21:14 -0700 Subject: [PATCH] Prevented uncaught exception if body is null --- lib/response.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/response.js b/lib/response.js index 398993a..242f0bc 100644 --- a/lib/response.js +++ b/lib/response.js @@ -74,6 +74,11 @@ var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, f } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this } // fallback for when writableStream or pipeTo aren't available + if (!response.body) { + global.clearTimeout(fetchTimer) + self.push(null) + return + } var reader = response.body.getReader() function read () { reader.read().then(function (result) {