Skip to content

Commit db73d26

Browse files
MagRat04Chase Gatyas
andauthored
optional chaining for accept headers, updated order of req/res variables (#362)
Co-authored-by: Chase Gatyas <cgatyas@redhat.com>
1 parent 1fc336c commit db73d26

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

app/spandx.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ async function init(confIn) {
8484

8585
if (_.get(conf, "esi")) {
8686
console.log("ESI enabled");
87-
app.use((res, req, next) => {
87+
app.use((req, res, next) => {
8888
console.log("request received");
8989
if (
90-
res.headers.accept.includes("text/html") ||
91-
res.headers.accept.includes("*/*")
90+
req.headers.accept?.includes("text/html") ||
91+
req.headers.accept?.includes("*/*")
9292
) {
9393
console.log("it is html; applying ESI");
94-
transformerProxy(createEsiMiddleware(conf))(res, req, next);
94+
transformerProxy(createEsiMiddleware(conf))(req, res, next);
9595
} else {
9696
console.log("it is not html");
9797
next();

0 commit comments

Comments
 (0)