[Updater > Request] Clean up source
This commit is contained in:
parent
b611a32f90
commit
b73ba369f9
1 changed files with 5 additions and 15 deletions
|
@ -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');
|
Loading…
Reference in a new issue