Skip to content
Myr

Added "strict routing" setting tests

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 76f6545 · Browse files · 1 file+58 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+58 added−0 removed

  • tests:+58 added−0 removed

1 file+58 added−0 removed

modified:test/app.router.js+58 added
115 unmodified lines
116 request(app)117 .get('/user/')118 .expect('tj', done);119 })120 121 describe('when "strict routing" is enabled', function(){122 it('should match trailing slashes', function(done){123 var app = express();124125 app.enable('strict routing');126127 app.get('/user/', function(req, res){128 res.end('tj');129 });130131 request(app)132 .get('/user/')133 .expect('tj', done);134 })135 136 it('should match no slashes', function(done){137 var app = express();138139 app.enable('strict routing');140141 app.get('/user', function(req, res){142 res.end('tj');143 });144145 request(app)146 .get('/user')147 .expect('tj', done);148 })149 150 it('should fail when omitting the trailing slash', function(done){151 var app = express();152153 app.enable('strict routing');154155 app.get('/user/', function(req, res){156 res.end('tj');157 });158159 request(app)160 .get('/user')161 .expect('Cannot GET /user', done);162 })163 164 it('should fail when adding the trailing slash', function(done){165 var app = express();166167 app.enable('strict routing');168169 app.get('/user', function(req, res){170 res.end('tj');171 });172173 request(app)174 .get('/user/')175 .expect('Cannot GET /user/', done);176 })177 })178 })179180 describe(':name', function(){181 it('should denote a capture group', function(done){
52 unmodified lines