Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-tree-router

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-tree-router - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

12

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc