Skip to content

Commit

Permalink
[plugin/download] expose the request's abort method on the response
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Aug 14, 2015
1 parent afb283d commit b0711eb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cli/plugin/pluginDownloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,15 @@ module.exports = function (settings, logger) {
if (timeout) timeout = false;

return Promise.fromNode(cb => {
return wreck.defaults({ timeout }).request('GET', url, null, cb);
let request = wreck
.defaults({ timeout })
.request('GET', url, null, (err, response) => {
if (err || !response) cb(err);

response.request = request;
response.abort = () => request.abort();
cb(null, response);
});
})
.catch(function (err) {
if (err.message.match(/invalid uri/i)) {
Expand Down

0 comments on commit b0711eb

Please sign in to comment.