diff --git a/src/services/request.js b/src/services/request.js index 1c0879068..41d31f774 100644 --- a/src/services/request.js +++ b/src/services/request.js @@ -9,12 +9,13 @@ const syncOptions = require('./sync_options'); // this allows to support system proxy function exec(opts) { + const client = getClient(opts); + // hack for cases where electron.net does not work but we don't want to set proxy if (opts.proxy === 'noproxy') { opts.proxy = null; } - const client = getClient(opts); const proxyAgent = getProxyAgent(opts); const parsedTargetUrl = url.parse(opts.url); @@ -111,6 +112,8 @@ async function getImage(imageUrl) { request.on('error', err => reject(generateError(opts, err))); + request.on('abort', err => reject(generateError(opts, err))); + request.on('response', response => { if (![200, 201, 204].includes(response.statusCode)) { reject(generateError(opts, response.statusCode + ' ' + response.statusMessage));