aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/requests.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-28 11:16:08 +0100
committerChocobozzz <me@florianbigard.com>2017-12-28 11:16:08 +0100
commitda854ddd502cd70685ef779c673b9e63757b8aa0 (patch)
tree21501d170cceaa044a5f23449cbd2eb47fd6415d /server/helpers/requests.ts
parentf40bbe3146553ef45515ee6b6d93ce6028f045ca (diff)
downloadPeerTube-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.ts8
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 @@
1import * as Promise from 'bluebird' 1import * as Promise from 'bluebird'
2import { createWriteStream } from 'fs' 2import { createWriteStream } from 'fs'
3import * as request from 'request' 3import * as request from 'request'
4import { ACTIVITY_PUB } from '../initializers'
5
6function 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
5function 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 })