aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-15 11:10:46 +0100
committerChocobozzz <me@florianbigard.com>2018-01-15 11:28:41 +0100
commit6b2ef589ed8ef5d253f6213e1bb275cbe135f2b4 (patch)
tree78ca2afa162c9da0b4e013644f3a8c5b49e26436 /server/helpers
parent633868bc2c638ab15c31513bc0da7de92944bffc (diff)
downloadPeerTube-6b2ef589ed8ef5d253f6213e1bb275cbe135f2b4.tar.gz
PeerTube-6b2ef589ed8ef5d253f6213e1bb275cbe135f2b4.tar.zst
PeerTube-6b2ef589ed8ef5d253f6213e1bb275cbe135f2b4.zip
Prepare production workflow
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/requests.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts
index e8d77b15b..eb8a12868 100644
--- a/server/helpers/requests.ts
+++ b/server/helpers/requests.ts
@@ -1,8 +1,7 @@
1import * as Promise from 'bluebird' 1import * as Bluebird 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' 4import { ACTIVITY_PUB } from '../initializers'
5import Bluebird = require('bluebird')
6 5
7function doRequest ( 6function doRequest (
8 requestOptions: request.CoreOptions & request.UriOptions & { activityPub?: boolean } 7 requestOptions: request.CoreOptions & request.UriOptions & { activityPub?: boolean }
@@ -12,13 +11,13 @@ function doRequest (
12 requestOptions.headers['accept'] = ACTIVITY_PUB.ACCEPT_HEADER 11 requestOptions.headers['accept'] = ACTIVITY_PUB.ACCEPT_HEADER
13 } 12 }
14 13
15 return new Promise<{ response: request.RequestResponse, body: any }>((res, rej) => { 14 return new Bluebird<{ response: request.RequestResponse, body: any }>((res, rej) => {
16 request(requestOptions, (err, response, body) => err ? rej(err) : res({ response, body })) 15 request(requestOptions, (err, response, body) => err ? rej(err) : res({ response, body }))
17 }) 16 })
18} 17}
19 18
20function doRequestAndSaveToFile (requestOptions: request.CoreOptions & request.UriOptions, destPath: string) { 19function doRequestAndSaveToFile (requestOptions: request.CoreOptions & request.UriOptions, destPath: string) {
21 return new Promise<request.RequestResponse>((res, rej) => { 20 return new Bluebird<request.RequestResponse>((res, rej) => {
22 request(requestOptions) 21 request(requestOptions)
23 .on('response', response => res(response as request.RequestResponse)) 22 .on('response', response => res(response as request.RequestResponse))
24 .on('error', err => rej(err)) 23 .on('error', err => rej(err))