Refactoring
This commit is contained in:
parent
cdf65aedcb
commit
0df093383d
@ -20,20 +20,15 @@ export default (user: ILocalUser, url: string, object: any) => new Promise((reso
|
||||
method: 'POST',
|
||||
path: pathname + search,
|
||||
}, res => {
|
||||
res.on('end', () => {
|
||||
log(`${url} --> ${res.statusCode}`);
|
||||
|
||||
if (res.statusCode >= 200 && res.statusCode < 300) {
|
||||
resolve();
|
||||
if (res.statusCode >= 400) {
|
||||
reject();
|
||||
} else {
|
||||
reject(res);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
|
||||
res.on('data', () => {});
|
||||
res.on('error', reject);
|
||||
});
|
||||
|
||||
sign(req, {
|
||||
authorizationHeaderName: 'Signature',
|
||||
key: user.keypair,
|
||||
|
Loading…
Reference in New Issue
Block a user