Merge pull request #770 from dannycoates/i759

test client shouldn't send 'undefined' accept-language
This commit is contained in:
Danny Coates 2014-07-27 20:03:03 -07:00
Родитель f611d3a8e6 ae8fac776f
Коммит ca29eeee13
2 изменённых файлов: 2 добавлений и 7 удалений

Просмотреть файл

@ -147,10 +147,7 @@ module.exports = function (path, url, Hapi) {
)
function trimLocale(header) {
if (!header || header === 'undefined') {
return null
}
if (header.length < 256) {
if (!header || header.length < 256) {
return header
}
var parts = header.split(',')
@ -171,7 +168,6 @@ module.exports = function (path, url, Hapi) {
// Remove empty items from the list, in case of badly-formed header.
request.app.remoteAddressChain = xff.filter(function(x){ return x })
request.app.clientAddress = request.app.remoteAddressChain[0]
request.app.acceptLanguage = trimLocale(request.headers['accept-language'])
if (request.headers.authorization) {
@ -213,5 +209,3 @@ module.exports = function (path, url, Hapi) {
create: create
}
}

Просмотреть файл

@ -49,6 +49,7 @@ ClientApi.prototype.doRequest = function (method, url, token, payload, headers)
headers: headers,
json: payload || true
}
if (headers['accept-language'] === undefined) { delete headers['accept-language']}
this.emit('startRequest', options)
request(options, function (err, res, body) {
if (res && res.headers.timestamp) {