Skip to content
Myr

req.ips.js

This file

Path

test/req.ips.js

55 lines · 1.3 KiB · JavaScript

Last changed by

Added `req.ip`TJ Holowaychukbefore adoptiond84d0b6

History of this file

Take it

The walk stopped after 200 commits: lines older than 2c14d0c point at it.

clean up weird whitespace in error-pages acceptance testsTJ Holowaychukbefore adoption2c14d0c

lines 1–7why, one step back
1
2var express = require('../')3 , request = require('./support/http');45describe('req', function(){6 describe('.ips', function(){7 describe('when X-Forwarded-For is present', function(){

Added `req.ip`TJ Holowaychukbefore adoptiond84d0b6

line 8why, one step back
8 describe('when "trust proxy" is enabled', function(){

Fixed setting check for req.ipsTJ Holowaychukbefore adoptione3cbac2

lines 9–10why, one step back
9 it('should return an array of the specified addresses', function(done){
10 var app = express();

clean up weird whitespace in error-pages acceptance testsTJ Holowaychukbefore adoption2c14d0c

line 11why, one step back
11

Fixed setting check for req.ipsTJ Holowaychukbefore adoptione3cbac2

line 12why, one step back
12 app.enable('trust proxy');

clean up weird whitespace in error-pages acceptance testsTJ Holowaychukbefore adoption2c14d0c

line 13why, one step back
13

Fixed setting check for req.ipsTJ Holowaychukbefore adoptione3cbac2

lines 14–20why, one step back
14 app.use(function(req, res, next){
15 res.send(req.ips);16 });1718 request(app)19 .get('/')20 .set('X-Forwarded-For', 'client, p1, p2')

Changed: dont reverse `req.ips`TJ Holowaychukbefore adoptionb694ba2

line 21why, one step back
21 .expect('["client","p1","p2"]', done);

Fixed setting check for req.ipsTJ Holowaychukbefore adoptione3cbac2

lines 22–24why, one step back
22 })
23 })24

Added `req.ip`TJ Holowaychukbefore adoptiond84d0b6

line 25why, one step back
25 describe('when "trust proxy" is disabled', function(){

Fixed setting check for req.ipsTJ Holowaychukbefore adoptione3cbac2

lines 26–37why, one step back
26 it('should return an empty array', function(done){
27 var app = express();2829 app.use(function(req, res, next){30 res.send(req.ips);31 });3233 request(app)34 .get('/')35 .set('X-Forwarded-For', 'client, p1, p2')36 .expect('[]', done);37 })

clean up weird whitespace in error-pages acceptance testsTJ Holowaychukbefore adoption2c14d0c

lines 38–55why, one step back
38 })
39 })4041 describe('when X-Forwarded-For is not present', function(){42 it('should return []', function(done){43 var app = express();4445 app.use(function(req, res, next){46 res.send(req.ips);47 });4849 request(app)50 .get('/')51 .expect('[]', done);52 })53 })54 })55})