You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cat index.js
const router = require('find-my-way')({
caseSensitive: false
});
const routePatterns = [
'/Foo/bar/:baz',
'/Foo/baz/:bar',
];
routePatterns.forEach(function addRoute(routePattern) {
console.log('adding route for pattern:', routePattern);
router.on('GET', routePattern, (req, res, params) => {
res.end('{"message":"hello world"}')
});
});
$ npm ls find-my-way
test-find-my-way@1.0.0 /Users/jgilli/dev/test-find-my-way
└── find-my-way@1.15.3
$ node --version
v6.14.3
$ node index.js
adding route for pattern: /Foo/bar/:baz
adding route for pattern: /Foo/baz/:bar
assert.js:84
throw new assert.AssertionError({
^
AssertionError: There is already a child with label ':'
at Node.addChild (/Users/jgilli/dev/test-find-my-way/node_modules/find-my-way/node.js:57:3)
at Router._insert (/Users/jgilli/dev/test-find-my-way/node_modules/find-my-way/index.js:249:19)
at Router._on (/Users/jgilli/dev/test-find-my-way/node_modules/find-my-way/index.js:145:21)
at Router.on (/Users/jgilli/dev/test-find-my-way/node_modules/find-my-way/index.js:58:8)
at addRoute (/Users/jgilli/dev/test-find-my-way/index.js:13:10)
at Array.forEach (native)
at Object.<anonymous> (/Users/jgilli/dev/test-find-my-way/index.js:10:15)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
$
Changing those routes to be all lowercase seems to work around the problem. Not passing {caseSensitive: false} to the Router constructor also works around it.
The text was updated successfully, but these errors were encountered:
Here's a repro of the problem I'm seeing:
Changing those routes to be all lowercase seems to work around the problem. Not passing
{caseSensitive: false}
to theRouter
constructor also works around it.The text was updated successfully, but these errors were encountered: