[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));
|
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');
|
|
Loading…
Reference in a new issue