Comparing version 1.0.1 to 1.0.2
@@ -37,3 +37,3 @@ var url = require('url'); | ||
var pattern = url[0].replace(/\/:\w+/g, '(?:/([^\/]+))'); | ||
url[0] = new RegExp('^' + pattern + '$'); | ||
url[0] = new RegExp('^(?:' + pattern + ')$'); | ||
return url; | ||
@@ -40,0 +40,0 @@ }); |
@@ -6,3 +6,3 @@ { | ||
"author": "Caolan McMahon", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"repository": { | ||
@@ -9,0 +9,0 @@ "type": "git", |
@@ -288,1 +288,24 @@ var dispatch = require('../lib/dispatch'); | ||
exports['regexp with pipe'] = function (test) { | ||
test.expect(2); | ||
var requestFactory = function(url){ return {url: url, method: 'GET'}; }; | ||
var called = function(req, res){ | ||
test.ok(true); | ||
}; | ||
var notCalled = function(req, res){ | ||
test.ok(false, 'should not be called'); | ||
}; | ||
dispatch({ | ||
'/x|/y': called | ||
})(requestFactory('/x'), 'response'); | ||
dispatch({ | ||
'/x|/y': called | ||
})(requestFactory('/y'), 'response'); | ||
dispatch({ | ||
'/x|/y': notCalled | ||
})(requestFactory('/xx'), 'response'); | ||
dispatch({ | ||
'/x|/y': notCalled | ||
})(requestFactory('/yy'), 'response'); | ||
test.done(); | ||
}; |
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
17350
368
5