4b1a1da652
closes #553 Update test: application -> use() should throw if not a function Fix lint Use arrow function Refactor test using arrow function Remove non mandatory brackets fix for merge Fix: missing refactor after merge Use arrow function for old generator
26 lines
705 B
JavaScript
26 lines
705 B
JavaScript
|
|
'use strict';
|
|
|
|
const request = require('../helpers/context').request;
|
|
|
|
describe('req.ips', () => {
|
|
describe('when X-Forwarded-For is present', () => {
|
|
describe('and proxy is not trusted', () => {
|
|
it('should be ignored', () => {
|
|
const req = request();
|
|
req.app.proxy = false;
|
|
req.header['x-forwarded-for'] = '127.0.0.1,127.0.0.2';
|
|
req.ips.should.eql([]);
|
|
});
|
|
});
|
|
|
|
describe('and proxy is trusted', () => {
|
|
it('should be used', () => {
|
|
const req = request();
|
|
req.app.proxy = true;
|
|
req.header['x-forwarded-for'] = '127.0.0.1,127.0.0.2';
|
|
req.ips.should.eql(['127.0.0.1', '127.0.0.2']);
|
|
});
|
|
});
|
|
});
|
|
});
|