[Updater > Request] Clean up source

This commit is contained in:
Ducko 2022-01-30 20:13:32 +00:00
parent b611a32f90
commit b73ba369f9

View file

@ -55,20 +55,10 @@ const nodeRequest = ({ method, url, headers, qs, timeout, body, stream }) => new
req.on('error', err => reject(err)); req.on('error', err => reject(err));
}); });
function requestWithMethod(method, options) { const withMethod = (method, options) => {
if (typeof options === 'string') { if (typeof options === 'string') options = { url: options };
options = {
url: options
};
}
options = { ...options, return nodeRequest({ ...options, method });
method };
};
log('Updater > Request', method, options.url); exports.get = withMethod.bind(null, 'GET');
return nodeRequest(options);
}
exports.get = requestWithMethod.bind(null, 'GET');