find-my-way
Advanced tools
Comparing version 1.9.1 to 1.10.0
@@ -38,2 +38,3 @@ 'use strict' | ||
this.ignoreTrailingSlash = opts.ignoreTrailingSlash || false | ||
this.maxParamLength = opts.maxParamLength || 100 | ||
this.tree = new Node() | ||
@@ -268,2 +269,3 @@ this.routes = [] | ||
Router.prototype.find = function find (method, path) { | ||
var maxParamLength = this.maxParamLength | ||
var currentNode = this.tree | ||
@@ -353,2 +355,3 @@ var wildcardNode = null | ||
while (i < pathLen && path.charCodeAt(i) !== 47) i++ | ||
if (i > maxParamLength) return null | ||
decoded = fastDecode(path.slice(0, i)) | ||
@@ -380,2 +383,3 @@ if (errored) { | ||
while (i < pathLen && path.charCodeAt(i) !== 47) i++ | ||
if (i > maxParamLength) return null | ||
decoded = fastDecode(path.slice(0, i)) | ||
@@ -401,2 +405,3 @@ if (errored) { | ||
while (i < pathLen && path.charCodeAt(i) !== 47 && path.charCodeAt(i) !== 45) i++ | ||
if (i > maxParamLength) return null | ||
} | ||
@@ -403,0 +408,0 @@ decoded = fastDecode(path.slice(0, i)) |
{ | ||
"name": "find-my-way", | ||
"version": "1.9.1", | ||
"version": "1.10.0", | ||
"description": "Crazy fast http radix based router", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -63,2 +63,9 @@ # find-my-way | ||
You can set a custom length for parameters in parametric *(standard, regex and multi)* routes by using `maxParamLength` option, the default value is 100 characters.<br/> | ||
*If the maximum length limit is reached, the default route will be invoked.* | ||
```js | ||
const router = require('find-my-way')({ | ||
maxParamLength: 500 | ||
}) | ||
``` | ||
<a name="on"></a> | ||
@@ -65,0 +72,0 @@ #### on(method, path, handler, [store]) |
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
98558
22
2885
263