chunithm.ts: Beat compression m/ware with a wrench

Force unconditional compression of responses harder.
This commit is contained in:
Tau
2019-11-06 17:28:30 -05:00
parent 39849483c8
commit 84023e2eb8
+14 -1
View File
@@ -8,7 +8,20 @@ const app = express();
// attempt to inflate whatever response we send to it whether there's a
// Transfer-Encoding header or not.
app.use(compression());
app.use(function(req, res, next) {
// Chunithm client does not follow the HTTP spec: user agents must indicate
// that they are willing to accept a particular Transfer-Encoding for that
// T-E to be used (unless the T-E in question is "chunked" but w/e), and this
// indication is advisory anyway, the server is permitted to ignore it.
//
// Force this header into the request, since it is not present normally.
req.headers["accept-encoding"] = "deflate";
return next();
});
app.use(compression({ threshold: 0 }));
app.use(express.json());
// Trace requests and responses