[Updater > Request] Clean up source

This commit is contained in:
Ducko 2022-01-30 20:13:32 +00:00
parent b611a32f90
commit b73ba369f9
1 changed files with 5 additions and 15 deletions

View File

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