Skip to content

Commit

Permalink
Removing more headers from redirect responses, fixing a test
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Jun 4, 2018
1 parent e97e7dc commit 7ec67d9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion lib/tenso.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,15 @@ class Tenso extends HTTPMethods {
}
});

if (status >= 300 && status < 400 && rheaders["cache-control"] !== void 0) {
if (status >= 300 && status < 400) {
res.removeHeader("accept-ranges");
res.removeHeader("cache-control");
res.removeHeader("content-type");
res.removeHeader("content-length");
delete headers["accept-ranges"];
delete headers["cache-control"];
delete headers["content-type"];
delete headers["content-length"];
}

if (status !== 416 && req.headers.range !== void 0 && !res.hasHeader("content-range") && headers["content-range"] === void 0) {
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": "7.0.10",
"version": "7.0.11",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion test/auth_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ describe("Local", function () {
.reuseHeader(csrf)
.json({username: "test", password: valid})
.expectStatus(302)
.expectHeader("content-type", "text/html; charset=utf-8") // anti-pattern of strategy
.expectHeader("content-type", undefined) // anti-pattern of strategy
.expectHeader("location", "/")
.end();
});
Expand Down

0 comments on commit 7ec67d9

Please sign in to comment.