Skip to content

Commit

Permalink
fix: Fix test failures in node v4-v12
Browse files Browse the repository at this point in the history
These failures were introduced by PR tomas#392

Closes tomas#397
  • Loading branch information
joeyparrish committed Mar 22, 2022
1 parent 67ad8a4 commit 2174b32
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/needle.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,11 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,
out.done = true;

// An error can still be fired after closing. In particular, on macOS.
// Adding an explicit abort() call resolves this without leaving a dangling
// listener. See also:
// See also:
// - https://github.com/tomas/needle/issues/391
// - https://github.com/less/less.js/issues/3693
// - https://github.com/nodejs/node/issues/27916
request.abort();
request.once('error', function() {});

if (callback)
return callback(err, resp, resp ? resp.body : undefined);
Expand Down

0 comments on commit 2174b32

Please sign in to comment.