connect-slashes
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -41,3 +41,4 @@ /** | ||
if ( "GET" == req.method ) { | ||
var url = req.url.split( reQuery ) | ||
// Use originalUrl when defined ( for express compatibility); | ||
var url = (req.originalUrl || req.url).split( reQuery ) | ||
, location = url[ 0 ] | ||
@@ -44,0 +45,0 @@ , redirect |
{ | ||
"name": "connect-slashes", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Trailing slash redirect middleware for Connect and Express.js", | ||
@@ -18,2 +18,5 @@ "keywords": [ "trailing", "slash", "connect", "middleware", "express" ], | ||
}, | ||
"scripts": { | ||
"test": "node_modules/mocha/bin/mocha" | ||
}, | ||
"main": "index", | ||
@@ -20,0 +23,0 @@ "license": "MIT", |
@@ -40,2 +40,14 @@ var slashes = require( ".." ), | ||
// | ||
it( "should append slashes for GET requests using originalUrl", function( done ) { | ||
append( { method: "GET", originalUrl: "/foo" }, { | ||
writeHead: function( status, headers ) { | ||
assert( "/foo/" == headers.Location ); | ||
}, | ||
end: done | ||
}, function() { | ||
assert( false ); // no redirect took place | ||
} ); | ||
}); | ||
// | ||
it( "should remove slashes", function( done ) { | ||
@@ -53,2 +65,14 @@ slashes( false )( { method: "GET", url: "/foo/" }, { | ||
// | ||
it( "should remove slashes when using originalUrl", function( done ) { | ||
slashes( false )( { method: "GET", originalUrl: "/foo/" }, { | ||
writeHead: function( status, headers ) { | ||
assert( "/foo" == headers.Location ); | ||
}, | ||
end: done | ||
}, function() { | ||
assert( false ); // no redirect took place | ||
} ); | ||
}); | ||
// | ||
it( "should move permanenetly (301)", function( done ) { | ||
@@ -150,2 +174,2 @@ append( { method: "GET", url: "/foo" }, { | ||
} ); | ||
} ); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12132
225