Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connect-slashes

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-slashes - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

3

lib/connect-slashes.js

@@ -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" }, {

} );
} );
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc