koa-trie-router
Advanced tools
Comparing version 1.0.10 to 1.1.0
@@ -7,3 +7,8 @@ var Router = require('./router') | ||
return function* trieRouter (next) { | ||
var match = trie.match(this.request.path) | ||
try { | ||
var match = trie.match(this.request.path) | ||
} catch (err) { | ||
err.code = 'MALFORMEDURL' | ||
throw err | ||
} | ||
var node = match && match.node | ||
@@ -10,0 +15,0 @@ // If no route match or no methods are defined, go to next middleware |
{ | ||
"name": "koa-trie-router", | ||
"description": "Trie-routing for Koa", | ||
"version": "1.0.10", | ||
"version": "1.1.0", | ||
"author": { | ||
@@ -28,5 +28,5 @@ "name": "Jonathan Ong", | ||
"scripts": { | ||
"test": "mocha --harmony-generators --reporter spec --require should", | ||
"test-cov": "node --harmony-generators node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should", | ||
"test-travis": "node --harmony-generators node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot --require should" | ||
"test": "mocha --harmony --reporter spec --require should", | ||
"test-cov": "node --harmony node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should", | ||
"test-travis": "node --harmony node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot --require should" | ||
}, | ||
@@ -33,0 +33,0 @@ "files": [ |
@@ -109,2 +109,9 @@ # Koa Trie Router | ||
### Error handling | ||
The middleware throws an error with `code` _MALFORMEDURL_ when it encounters | ||
a malformed path. An application can _try/catch_ this upstream, identify the error | ||
by its code, and handle it however the developer chooses in the context of the | ||
application- for example, re-throw as a 404. | ||
### Path Definitions | ||
@@ -111,0 +118,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
10621
8
152
132
1