find-my-way
Advanced tools
Comparing version 1.15.3 to 1.15.4
@@ -145,3 +145,7 @@ 'use strict' | ||
if (i === len) { | ||
return this._insert(method, path.slice(0, i), nodeType, params, handler, store, regex, version) | ||
var completedPath = path.slice(0, i) | ||
if (this.caseSensitive === false) { | ||
completedPath = completedPath.toLowerCase() | ||
} | ||
return this._insert(method, completedPath, nodeType, params, handler, store, regex, version) | ||
} | ||
@@ -148,0 +152,0 @@ // add the parameter and continue with the search |
{ | ||
"name": "find-my-way", | ||
"version": "1.15.3", | ||
"version": "1.15.4", | ||
"description": "Crazy fast http radix based router", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -91,1 +91,47 @@ 'use strict' | ||
}) | ||
test('case insensitive with capital letter in static path with param', t => { | ||
t.plan(1) | ||
const findMyWay = FindMyWay({ | ||
caseSensitive: false, | ||
defaultRoute: (req, res) => { | ||
t.fail('Should not be defaultRoute') | ||
} | ||
}) | ||
findMyWay.on('GET', '/Foo/bar/:param', (req, res, params) => { | ||
console.log('baz') | ||
t.equal(params.param, 'baz') | ||
}) | ||
findMyWay.lookup({ method: 'GET', url: '/Foo/bar/baz', headers: {} }, null) | ||
}) | ||
test('case insensitive with multiple paths containing capital letter in static path with param', t => { | ||
/* | ||
* This is a reproduction of the issue documented at | ||
* https://github.com/delvedor/find-my-way/issues/96. | ||
*/ | ||
t.plan(2) | ||
const findMyWay = FindMyWay({ | ||
caseSensitive: false, | ||
defaultRoute: (req, res) => { | ||
t.fail('Should not be defaultRoute') | ||
} | ||
}) | ||
findMyWay.on('GET', '/Foo/bar/:param', (req, res, params) => { | ||
console.log('baz') | ||
t.equal(params.param, 'baz') | ||
}) | ||
findMyWay.on('GET', '/Foo/baz/:param', (req, res, params) => { | ||
console.log('bar') | ||
t.equal(params.param, 'bar') | ||
}) | ||
findMyWay.lookup({ method: 'GET', url: '/Foo/bar/baz', headers: {} }, null) | ||
findMyWay.lookup({ method: 'GET', url: '/Foo/baz/bar', headers: {} }, null) | ||
}) |
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
132080
3748