req.protocol.js
This file
Path
test/req.protocol.js
65 lines · 1.4 KiB · JavaScript
Last changed by
updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e
History of this fileTake it
The walk stopped after 200 commits: lines older than bbaa295 point at it.
Merge branch 'master' of github.com:visionmedia/expressTJ Holowaychukbefore adoptionbbaa295
lines 1–15why, one step back12var express = require('../')3 , request = require('./support/http');45describe('req', function(){6 describe('.protocol', function(){7 it('should return the protocol string', function(done){8 var app = express();910 app.use(function(req, res){11 res.end(req.protocol);12 });1314 request(app)15 .get('/')updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e
line 16why, one step back16 .expect('http', done);Merge branch 'master' of github.com:visionmedia/expressTJ Holowaychukbefore adoptionbbaa295
lines 17–31why, one step back17 })1819 describe('when "trust proxy" is enabled', function(){20 it('should respect X-Forwarded-Proto', function(done){21 var app = express();2223 app.enable('trust proxy');2425 app.use(function(req, res){26 res.end(req.protocol);27 });2829 request(app)30 .get('/')31 .set('X-Forwarded-Proto', 'https')updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e
line 32why, one step back32 .expect('https', done);Merge branch 'master' of github.com:visionmedia/expressTJ Holowaychukbefore adoptionbbaa295
lines 33–45why, one step back33 })3435 it('should default to http', function(done){36 var app = express();3738 app.enable('trust proxy');3940 app.use(function(req, res){41 res.end(req.protocol);42 });4344 request(app)45 .get('/')updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e
line 46why, one step back46 .expect('http', done);Merge branch 'master' of github.com:visionmedia/expressTJ Holowaychukbefore adoptionbbaa295
lines 47–60why, one step back47 })48 })4950 describe('when "trust proxy" is disabled', function(){51 it('should ignore X-Forwarded-Proto', function(done){52 var app = express();5354 app.use(function(req, res){55 res.end(req.protocol);56 });5758 request(app)59 .get('/')60 .set('X-Forwarded-Proto', 'https')updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e
line 61why, one step back61 .expect('http', done);Merge branch 'master' of github.com:visionmedia/expressTJ Holowaychukbefore adoptionbbaa295
lines 62–65why, one step back62 })63 })64 })65})