Comparing version 1.0.7 to 1.0.9
@@ -5,3 +5,3 @@ "use strict"; | ||
Woodland = require(path.join(__dirname, "lib", "woodland.js")), | ||
all = "all", | ||
all = require(path.join(__dirname, "lib", "all.js")), | ||
max = 1000, | ||
@@ -8,0 +8,0 @@ random = Math.floor(Math.random() * max) + 1; |
@@ -10,5 +10,6 @@ "use strict"; | ||
utility = require(path.join(__dirname, "utility.js")), | ||
regex = require(path.join(__dirname, "regex.js")), | ||
all = "all", | ||
all = require(path.join(__dirname, "all.js")), | ||
allMethod = all.toUpperCase(), | ||
head = /^(HEAD|OPTIONS)$/, | ||
space = /\s+/, | ||
methods = ["DELETE", "GET", "POST", "PUT", "PATCH"]; | ||
@@ -110,7 +111,6 @@ | ||
let deferred = defer(), | ||
byRef = [req, res], | ||
method = regex.head.test(req.method) ? "GET" : req.method, | ||
method = head.test(req.method) ? "GET" : req.method, | ||
middleware; | ||
this.decorate(byRef[0], byRef[1]); | ||
this.decorate(req, res); | ||
middleware = array.iterator(this.routes(req.parsed.pathname, req.host, method)); | ||
@@ -252,3 +252,3 @@ | ||
if (typeof lfn !== "function" && (lfn && typeof lfn.handle !== "function")) { | ||
if (typeof lfn !== "function") { | ||
throw new Error("Invalid middleware"); | ||
@@ -273,6 +273,2 @@ } | ||
if (lfn.handle) { | ||
lfn = lfn.handle; | ||
} | ||
lfn.hash = this.hash(lfn.toString()); | ||
@@ -290,3 +286,3 @@ mmethod.get(lpath).push(lfn); | ||
if (!utility.isEmpty(header)) { | ||
token = header.split(regex.space).pop() || ""; | ||
token = header.split(space).pop() || ""; | ||
auth = new Buffer(token, "base64").toString(); | ||
@@ -293,0 +289,0 @@ |
{ | ||
"name": "woodland", | ||
"version": "1.0.7", | ||
"version": "1.0.9", | ||
"description": "Lightweight HTTP/HTTPS router with virtual hosts", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
<img src="https://avoidwork.github.io/woodland/logo.svg" width="108" /> | ||
# woodland | ||
@@ -67,3 +68,3 @@ | ||
##### use (path, fn, method = "GET", host = "all") | ||
Registers middleware for a route; `path` is a regular expression, and if not passed it defaults to `/.*`. | ||
Registers middleware for a route. `path` is a regular expression, and if not passed it defaults to `/.*`. `method` can be `all` if you want the middleware to be used for all HTTP methods. | ||
@@ -70,0 +71,0 @@ ##### url (req) |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
76
14993
349
4