import * as Bluebird from 'bluebird' import * as request from 'request' function doRequest ( requestOptions: request.CoreOptions & request.UriOptions ): Bluebird<{ response: request.RequestResponse, body: T }> { if (!(requestOptions.headers)) requestOptions.headers = {} requestOptions.headers['User-Agent'] = 'PeerTube indexer' return new Bluebird<{ response: request.RequestResponse, body: T }>((res, rej) => { request(requestOptions, (err, response, body) => err ? rej(err) : res({ response, body })) }) } export { doRequest }