add 'user-agent' in HTTP header

This commit is contained in:
ZunSThy 2016-11-06 16:00:08 +08:00
parent e0ede27049
commit bd8bc9f6af

View File

@ -89,8 +89,14 @@ HTTPTracker.prototype._request = function (requestUrl, params, cb) {
var self = this var self = this
var u = requestUrl + (requestUrl.indexOf('?') === -1 ? '?' : '&') + var u = requestUrl + (requestUrl.indexOf('?') === -1 ? '?' : '&') +
common.querystringStringify(params) common.querystringStringify(params)
var opts = {
url: u,
header: {
'user-agent': self.client._userAgent || ''
}
}
get.concat(u, function (err, res, data) { get.concat(opts, function (err, res, data) {
if (self.destroyed) return if (self.destroyed) return
if (err) return self.client.emit('warning', err) if (err) return self.client.emit('warning', err)
if (res.statusCode !== 200) { if (res.statusCode !== 200) {