Skip to content

Commit

Permalink
Undoing an erroneous change
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Jan 7, 2020
1 parent f10cbba commit 485c750
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
9 changes: 1 addition & 8 deletions lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require("path"),
retsu = require("retsu"),
coerce = require("tiny-coerce"),
mime = require(path.join(__dirname, "mime.js")),
{hasBody} = require(path.join(__dirname, "shared.js")),
{hasBody, jsonWrap} = require(path.join(__dirname, "shared.js")),
regex = require(path.join(__dirname, "regex.js")),
rateHeaders = [
"x-ratelimit-limit",
Expand All @@ -27,13 +27,6 @@ function canGet (arg) {
return arg.includes("GET") || arg.includes("HEAD") || arg.includes("OPTIONS");
}

function jsonWrap (arg) {
const a = arg[0],
b = arg[arg.length - 1];

return (a === "\"" && b === "\"") || (a === "[" && b === "]") || (a === "{" && b === "}"); // eslint-disable-line no-extra-parens
}

function filecb (err, lstats, npath, nth, count, handled, req, res, next) {
if (err === null && handled === false) {
handled = true;
Expand Down
10 changes: 9 additions & 1 deletion lib/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ function hasBody (arg) {
return arg.includes("PATCH") || arg.includes("POST") || arg.includes("PUT");
}

function jsonWrap (arg) {
const a = arg[0],
b = arg[arg.length - 1];

return (a === "\"" && b === "\"") || (a === "[" && b === "]") || (a === "{" && b === "}"); // eslint-disable-line no-extra-parens
}

module.exports = {
hasBody
hasBody,
jsonWrap
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tenso",
"description": "Tensō is an HTTP/HTTP2 REST API framework",
"version": "15.0.9",
"version": "15.0.10",
"homepage": "https://github.com/avoidwork/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down

0 comments on commit 485c750

Please sign in to comment.