koa-tree-router
Advanced tools
Comparing version 0.2.2 to 0.3.0
{ | ||
"name": "koa-tree-router", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "A high performance koa router", | ||
@@ -37,9 +37,5 @@ "main": "router.js", | ||
"devDependencies": { | ||
"beautify-benchmark": "^0.2.4", | ||
"benchmark": "^2.1.4", | ||
"expect": "^22.2.2", | ||
"find-my-way": "^1.8.2", | ||
"koa": "^2.4.1", | ||
"koa-router": "^7.3.0", | ||
"mocha": "^5.0.0", | ||
"expect": "^22.4.3", | ||
"koa": "^2.5.0", | ||
"mocha": "^5.0.5", | ||
"supertest": "^3.0.0" | ||
@@ -46,0 +42,0 @@ }, |
@@ -9,3 +9,3 @@ # Koa tree router | ||
- Fast. Up to 12 times faster than Koa-router. [Benchmark](benchmark/index.js) | ||
- Fast. Up to 12 times faster than Koa-router. [Benchmark](https://github.com/delvedor/router-benchmark) | ||
@@ -12,0 +12,0 @@ - Express routing using `router.get`, `router.put`, `router.post`, etc. |
@@ -108,2 +108,4 @@ const compose = require("koa-compose"); | ||
if (handle405) { | ||
const allowList = []; | ||
// Search for allowed methods | ||
for (let key in router.trees) { | ||
@@ -116,7 +118,10 @@ if (key === ctx.method) { | ||
if (tree.search(ctx.path).handle !== null) { | ||
ctx.status = 405; | ||
return handle405(ctx, next); | ||
allowList.push(key); | ||
} | ||
} | ||
ctx.status = 405; | ||
ctx.set("Allow", allowList.join(", ")); | ||
return handle405(ctx, next); | ||
} | ||
@@ -123,0 +128,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
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
21702
4
581