From 3aac42d08b544d9a9ce96287fda3af9114d829ca Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 7 Jul 2022 02:55:16 -0600 Subject: [PATCH] fix: register otherwise silent http response error --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index ab1643e..52de083 100644 --- a/index.js +++ b/index.js @@ -120,6 +120,9 @@ function handleResponse(resp, opts, cb) { resp.body = ''; } resp._bodyLength = 0; + resp.once('error', function (err) { + cb(err, resp, resp.body); + }); resp.on('readable', function () { var chunk; while ((chunk = resp.read())) {