Skip to content

Commit

Permalink
Making etag() a little more robust (aka slow)
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Oct 29, 2018
1 parent df02856 commit c7973d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/tenso.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class Tenso extends Base {
}

etag (...args) {
return this.etags.create(args.join("-"));
return this.etags.create(args.map(i => typeof i !== "string" ? JSON.stringify(i) : i).join("-"));
}

finish (req, res) {
Expand All @@ -260,7 +260,7 @@ class Tenso extends Base {
}

if (status === 200 && this.canETag(req.parsed.pathname, req.method, res.getHeader("cache-control") || headers["cache-control"])) {
headers.etag = this.etag(body, req.parsed.href);
headers.etag = this.etag(body);
} else {
delete headers.etag;
delete headers["last-modified"];
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": "9.0.3",
"version": "9.0.4",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down

0 comments on commit c7973d1

Please sign in to comment.