From 739354090b7dac768c554d53a0e7075514619d41 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 7 Jul 2018 14:30:58 -0600 Subject: [PATCH] wrap onResponse for form-data's signature with error --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 06aaff0..bf2756f 100644 --- a/index.js +++ b/index.js @@ -260,7 +260,11 @@ function setDefaults(defs) { debug(formHeaders); // generally uploads don't use Chunked Encoding (some systems have issues with it) // and I don't want to do the work to calculate the content-lengths. This seems to work. - form.submit(finalOpts, onResponse); + form.submit(finalOpts, function (err, resp) { + if (err) { cb(err); } + onResponse(resp); + resp.resume(); + }); //req = requester.request(finalOpts, onResponse); //req.on('error', cb); //form.pipe(req);