Skip to content

Commit

Permalink
Adding etags.ignore to config for conditionally blocking ETag heade…
Browse files Browse the repository at this point in the history
…r creation on GET requests
  • Loading branch information
avoidwork committed Nov 27, 2016
1 parent 571a0fa commit cbb5887
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ To enable state propagation set `notify` to `true`, and when receiving new state
{
"etags": {
"notify": true,
"ignore": [], // Paths to ignore
"onchange": (eventName, serializedCache) => {
... // serializedCache needs to be passed to other instances `etags.update()`
},
Expand Down
3 changes: 3 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
"consumer_secret": ""
}
},
"etags": {
"ignore": []
},
"compress": true,
"headers": {
"cache-control": "max-age=60, must-revalidate"
Expand Down
2 changes: 1 addition & 1 deletion lib/tenso.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class Tenso {

output = this.render(req, utility.hypermedia(this.server, req, this.serialize(req, arg, resStatus), ref[0]), ref[0]);

if (req.method === "GET") {
if (this.server.canETag(req.parsed.pathname, req.method)) {
ref[0].etag = this.server.etag(output);
}

Expand Down
4 changes: 2 additions & 2 deletions 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": "4.1.5",
"version": "4.1.6",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down Expand Up @@ -44,7 +44,7 @@
"tiny-merge": "~1.0.0",
"tiny-uuid4": "~1.0.1",
"tiny-xml": "~1.0.6",
"turtle.io": "~7.3.0",
"turtle.io": "~7.3.2",
"yamljs": "~0.2.8",
"uws": "~0.7.0"
},
Expand Down

0 comments on commit cbb5887

Please sign in to comment.