+15
-8
@@ -9,2 +9,7 @@ var http = require('http'); | ||
| var NOT_FOUND = function(request, response) { | ||
| response.writeHead(404); | ||
| response.end(); | ||
| }; | ||
| var noop = function() {}; | ||
@@ -50,6 +55,3 @@ var toBuffer = function(param) { | ||
| self._methods[method] = []; | ||
| self._end[method] = function(request, response) { | ||
| response.writeHead(404); | ||
| response.end(); | ||
| }; | ||
| self._end[method] = NOT_FOUND; | ||
| }); | ||
@@ -124,4 +126,4 @@ }); | ||
| }; | ||
| Router.prototype.route = function(request, response) { | ||
| this._find(request, response); | ||
| Router.prototype.route = function(request, response, next) { | ||
| this._find(request, response, next); | ||
| }; | ||
@@ -188,6 +190,6 @@ Router.prototype.listen = function(port, callback) { | ||
| Router.prototype._find = function(request, response) { | ||
| Router.prototype._find = function(request, response, next) { | ||
| var method = request.method; | ||
| var routes = this._methods[method]; | ||
| var end = this._end[method] || noop; | ||
| var end = this._end[method]; | ||
| var index = 0; | ||
@@ -202,2 +204,7 @@ | ||
| if (index >= routes.length) { | ||
| if (next && (!end || end === NOT_FOUND)) { | ||
| next(); | ||
| return; | ||
| } | ||
| end(request, response, noop); | ||
@@ -204,0 +211,0 @@ return; |
+1
-1
| { | ||
| "name":"router", | ||
| "version":"0.5.6", | ||
| "version":"0.5.7", | ||
| "description":"A lean and mean web router", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
8850
1.24%243
2.1%