diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-28 11:16:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-28 11:16:08 +0100 |
commit | da854ddd502cd70685ef779c673b9e63757b8aa0 (patch) | |
tree | 21501d170cceaa044a5f23449cbd2eb47fd6415d /server/helpers/requests.ts | |
parent | f40bbe3146553ef45515ee6b6d93ce6028f045ca (diff) | |
download | PeerTube-da854ddd502cd70685ef779c673b9e63757b8aa0.tar.gz PeerTube-da854ddd502cd70685ef779c673b9e63757b8aa0.tar.zst PeerTube-da854ddd502cd70685ef779c673b9e63757b8aa0.zip |
Propagate old comment on new follow
Diffstat (limited to 'server/helpers/requests.ts')
-rw-r--r-- | server/helpers/requests.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts index 4b1deeadc..ce185a2c0 100644 --- a/server/helpers/requests.ts +++ b/server/helpers/requests.ts | |||
@@ -1,8 +1,14 @@ | |||
1 | import * as Promise from 'bluebird' | 1 | import * as Promise from 'bluebird' |
2 | import { createWriteStream } from 'fs' | 2 | import { createWriteStream } from 'fs' |
3 | import * as request from 'request' | 3 | import * as request from 'request' |
4 | import { ACTIVITY_PUB } from '../initializers' | ||
5 | |||
6 | function doRequest (requestOptions: request.CoreOptions & request.UriOptions & { activityPub?: boolean }) { | ||
7 | if (requestOptions.activityPub === true) { | ||
8 | if (!Array.isArray(requestOptions.headers)) requestOptions.headers = {} | ||
9 | requestOptions.headers['accept'] = ACTIVITY_PUB.ACCEPT_HEADER | ||
10 | } | ||
4 | 11 | ||
5 | function doRequest (requestOptions: request.CoreOptions & request.UriOptions) { | ||
6 | return new Promise<{ response: request.RequestResponse, body: any }>((res, rej) => { | 12 | return new Promise<{ response: request.RequestResponse, body: any }>((res, rej) => { |
7 | request(requestOptions, (err, response, body) => err ? rej(err) : res({ response, body })) | 13 | request(requestOptions, (err, response, body) => err ? rej(err) : res({ response, body })) |
8 | }) | 14 | }) |