Refactoring

This commit is contained in:
syuilo 2018-08-02 15:35:22 +09:00
parent cdf65aedcb
commit 0df093383d

View file

@ -20,20 +20,15 @@ export default (user: ILocalUser, url: string, object: any) => new Promise((reso
method: 'POST', method: 'POST',
path: pathname + search, path: pathname + search,
}, res => { }, res => {
res.on('end', () => {
log(`${url} --> ${res.statusCode}`); log(`${url} --> ${res.statusCode}`);
if (res.statusCode >= 200 && res.statusCode < 300) { if (res.statusCode >= 400) {
resolve(); reject();
} else { } else {
reject(res); resolve();
} }
}); });
res.on('data', () => {});
res.on('error', reject);
});
sign(req, { sign(req, {
authorizationHeaderName: 'Signature', authorizationHeaderName: 'Signature',
key: user.keypair, key: user.keypair,