Skip to content

Commit

Permalink
Returning an old friend (sigh)
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Nov 28, 2019
1 parent 45fac36 commit a7f9161
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
28 changes: 15 additions & 13 deletions lib/tenso.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,23 +247,25 @@ class Tenso extends Base {
req.unprotect = false;
req.server = this;
res.send = (body = "", status = 200, headers = {}) => {
let lbody = body;
if (!res.headersSent) {
let lbody = body;

for (const [key, value] of Object.entries(headers)) {
res.header(key, value);
}
for (const [key, value] of Object.entries(headers)) {
res.header(key, value);
}

res.statusCode = status;
res.statusCode = status;

if (lbody === null || typeof lbody.on !== "function") {
lbody = serialize(req, res, lbody);
lbody = hypermedia(req, res, lbody);
lbody = this.final(req, res, lbody);
lbody = this.render(req, res, lbody);
}
if (lbody === null || typeof lbody.on !== "function") {
lbody = serialize(req, res, lbody);
lbody = hypermedia(req, res, lbody);
lbody = this.final(req, res, lbody);
lbody = this.render(req, res, lbody);
}

lbody = this.send(req, res, lbody);
fn(lbody, res.statusCode);
lbody = this.send(req, res, lbody);
fn(lbody, res.statusCode);
}
};
}

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 HTTP/HTTP2 REST API framework",
"version": "15.0.5",
"version": "15.0.6",
"homepage": "https://github.com/avoidwork/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down

0 comments on commit a7f9161

Please sign in to comment.