Skip to content

Commit

Permalink
Removing unneeded ops & decoration
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Jul 10, 2018
1 parent 7ea4473 commit 44b93f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function parse (req, res, next) {
let valid = true,
exception;

if (regex.body.test(req.method) === true && req.body !== void 0) {
if (req.body !== void 0) {
const type = req.headers["content-type"];

if (regex.encodeForm.test(type) === true) {
Expand All @@ -103,7 +103,7 @@ function parse (req, res, next) {
}

function payload (req, res, next) {
req.invalid = false;
let invalid = false;

if (regex.body.test(req.method) === true) {
const obj = req.httpVersionMajor === 1 ? req : res;
Expand All @@ -115,13 +115,13 @@ function payload (req, res, next) {
body += data;

if (req.server.config.maxBytes > 0 && Buffer.byteLength(body) > req.server.config.maxBytes) {
req.invalid = true;
invalid = true;
next(new Error(413));
}
});

obj.on("end", () => {
if (req.invalid === false) {
if (invalid === false) {
if (body !== void 0) {
req.body = body;
}
Expand Down
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 elastic REST API gateway for node.js",
"version": "8.0.1",
"version": "8.0.2",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down

0 comments on commit 44b93f1

Please sign in to comment.