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

connect-modrewrite

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-modrewrite - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

5

Gruntfile.js

@@ -42,3 +42,6 @@ module.exports = function(grunt) {

'^/test/\\d*$ /index.html [L]',
'^/test/\\d*/\\d*$ /flag.html [L]'
// Test last flag
'^/test-flag$ /connection [L]',
'^/connection$ /flag.html'
]),

@@ -45,0 +48,0 @@ connect.static(options.base)

2

package.json
{
"name": "connect-modrewrite",
"main": "./src/modrewrite.js",
"version": "0.1.4",
"version": "0.1.5",
"description": "connect-modrewrite is a middleware for connect. It adds modrewrite functionality to your project",

@@ -6,0 +6,0 @@ "dependencies": {

@@ -26,4 +26,6 @@ module.exports = function(rules) {

// Rewrite Url
req.url = req.url.replace(rewrite.regex, rewrite.replace);
return rewrite.last;
if(rewrite.regex.test(req.url)) {
req.url = req.url.replace(rewrite.regex, rewrite.replace);
return rewrite.last;
}

@@ -53,4 +55,6 @@ // Else normalize path

// Rewrite Url
req.url = req.url.replace(rewrite.regex, rewrite.replace);
return rewrite.last;
if(rewrite.regex.test(req.url)) {
req.url = req.url.replace(rewrite.regex, rewrite.replace);
return rewrite.last;
}

@@ -57,0 +61,0 @@ } // End of normalization

@@ -43,17 +43,7 @@ var chai = require( 'chai' ),

it('should be able to recognize Last [L] flag', function(){
http.get('http://localhost:9001/test/2/1', function(res){
res.setEncoding('utf8');
res.on('data', function(chunk){
expect(chunk).to.be.a('string');
done();
});
it('should be able to recognize Last [L] flag', function(done){
http.get('http://localhost:9001/test-flag', function(res){
expect(res.statusCode).to.equal(404);
done();
});
http.get('http://localhost:9001/test/2/1', function(res){
res.setEncoding('utf8');
res.on('data', function(chunk){
expect(/flag-is-working/.test(chunk)).to.be.true;
done();
});
});
})

@@ -60,0 +50,0 @@

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