hmpo-logger
Advanced tools
Comparing version 6.0.0 to 6.1.0
@@ -181,10 +181,3 @@ const os = require('os'); | ||
if (!this.req) { return; } | ||
if (this.req.headers && this.req.headers['x-forwarded-for']) { | ||
const forwardedIP = this.req.headers['x-forwarded-for']; | ||
return forwardedIP.split(',')[0].trim(); | ||
} | ||
if (this.req.connection) { | ||
return this.req.connection.remoteAddress; | ||
} | ||
return this.req.ip || (this.req.connection && this.req.connection.remoteAddress); | ||
}), | ||
@@ -191,0 +184,0 @@ |
{ | ||
"name": "hmpo-logger", | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"description": "Consistent logging for hmpo apps", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -512,8 +512,6 @@ | ||
it('should return ip from x-forwarded-for', function () { | ||
it('should return ip from the processed request ip', function () { | ||
let context = { | ||
req: { | ||
headers: { | ||
'x-forwarded-for': '5678' | ||
}, | ||
ip: '5678', | ||
connection: { | ||
@@ -529,18 +527,2 @@ remoteAddress: '1234' | ||
it('should return ip from x-forwarded-for list', function () { | ||
let context = { | ||
req: { | ||
headers: { | ||
'x-forwarded-for': '5678, 8910' | ||
}, | ||
connection: { | ||
remoteAddress: '1234' | ||
} | ||
} | ||
}; | ||
Logger.tokens.clientip.fn.call(context) | ||
.should.equal('5678'); | ||
}); | ||
it('should return undefined for no req', function () { | ||
@@ -547,0 +529,0 @@ expect(Logger.tokens.clientip.fn.call({})) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122811
2761