Add user agent to requests
This commit is contained in:
parent
e886f1c937
commit
23f0d843c3
|
@ -4,6 +4,9 @@ import * as request from 'request'
|
|||
function doRequest <T> (
|
||||
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 }))
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue