Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix corner-cases in path case sensitivity.

Related to connect issue #663.
  • Loading branch information...
commit eefab5134c88efe35ff6ea3376ed442ff1207ecb 1 parent a47172d
@msiebuhr msiebuhr authored
Showing with 28 additions and 2 deletions.
  1. +1 −1  lib/proto.js
  2. +27 −1 test/mounting.js
View
2  lib/proto.js
@@ -162,7 +162,7 @@ app.handle = function(req, res, out) {
if (undefined == path) path = '/';
// skip this layer if the route doesn't match.
- if (0 != path.toLowerCase().indexOf(layer.route)) return next(err);
+ if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err);
c = path[layer.route.length];
if (c && '/' != c && '.' != c) return next(err);
View
28 test/mounting.js
@@ -106,7 +106,7 @@ describe('app.use()', function(){
})
})
- it('should be case insensitive', function(done){
+ it('should be case insensitive (lower-case route, mixed-case request)', function(done){
var blog = http.createServer(function(req, res){
req.url.should.equal('/');
res.end('blog');
@@ -118,4 +118,30 @@ describe('app.use()', function(){
.get('/BLog')
.expect('blog', done);
})
+
+ it('should be case insensitive (mixed-case route, lower-case request)', function(done){
+ var blog = http.createServer(function(req, res){
+ req.url.should.equal('/');
+ res.end('blog');
+ });
+
+ app.use('/BLog', blog);
+
+ app.request()
+ .get('/blog')
+ .expect('blog', done);
+ })
+
+ it('should be case insensitive (mixed-case route, mixed-case request)', function(done){
+ var blog = http.createServer(function(req, res){
+ req.url.should.equal('/');
+ res.end('blog');
+ });
+
+ app.use('/BLog', blog);
+
+ app.request()
+ .get('/blOG')
+ .expect('blog', done);
+ })
})
Please sign in to comment.
Something went wrong with that request. Please try again.