diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-08-02 15:35:22 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-08-02 15:35:22 +0900 |
| commit | 0df093383dfcb41b66c2d807b0c7f3fac9653f1f (patch) | |
| tree | 0008759af8967f6a57e2b8235db1960798b3daec /src/remote/activitypub | |
| parent | Merge branch 'master' of https://github.com/syuilo/misskey (diff) | |
| download | sharkey-0df093383dfcb41b66c2d807b0c7f3fac9653f1f.tar.gz sharkey-0df093383dfcb41b66c2d807b0c7f3fac9653f1f.tar.bz2 sharkey-0df093383dfcb41b66c2d807b0c7f3fac9653f1f.zip | |
Refactoring
Diffstat (limited to 'src/remote/activitypub')
| -rw-r--r-- | src/remote/activitypub/request.ts | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/remote/activitypub/request.ts b/src/remote/activitypub/request.ts index e2b600ae2e..585c1c0ce8 100644 --- a/src/remote/activitypub/request.ts +++ b/src/remote/activitypub/request.ts @@ -20,18 +20,13 @@ export default (user: ILocalUser, url: string, object: any) => new Promise((reso method: 'POST', path: pathname + search, }, res => { - res.on('end', () => { - log(`${url} --> ${res.statusCode}`); + log(`${url} --> ${res.statusCode}`); - if (res.statusCode >= 200 && res.statusCode < 300) { - resolve(); - } else { - reject(res); - } - }); - - res.on('data', () => {}); - res.on('error', reject); + if (res.statusCode >= 400) { + reject(); + } else { + resolve(); + } }); sign(req, { |