2 var express = require('../')
3 , request = require('supertest');
5 describe('req', function(){
6 describe('.ips', function(){
7 describe('when X-Forwarded-For is present', function(){
8 describe('when "trust proxy" is enabled', function(){
9 it('should return an array of the specified addresses', function(done){
12 app.enable('trust proxy');
14 app.use(function(req, res, next){
20 .set('X-Forwarded-For', 'client, p1, p2')
21 .expect('["client","p1","p2"]', done);
24 it('should stop at first untrusted', function(done){
27 app.set('trust proxy', 2);
29 app.use(function(req, res, next){
35 .set('X-Forwarded-For', 'client, p1, p2')
36 .expect('["p1","p2"]', done);
40 describe('when "trust proxy" is disabled', function(){
41 it('should return an empty array', function(done){
44 app.use(function(req, res, next){
50 .set('X-Forwarded-For', 'client, p1, p2')
56 describe('when X-Forwarded-For is not present', function(){
57 it('should return []', function(done){
60 app.use(function(req, res, next){