Browse Source

better error handling

http2
Sindre Sorhus 11 years ago
parent
commit
1b3aca9ab7
  1. 6
      index.js
  2. 1
      test.js

6
index.js

@ -49,10 +49,12 @@ module.exports = function (url, opts, cb) {
ret += data;
});
res.on('end', function () {
res.once('error', cb);
res.once('end', function () {
cb(null, ret);
});
}).on('error', cb);
}).once('error', cb);
};
get(url, opts, cb);

1
test.js

@ -42,4 +42,3 @@ it('should support optional options', function (done) {
done();
});
});

Loading…
Cancel
Save