Skip to content

Commit 7b67695

Browse files
authored
repo sync
2 parents 0f5597b + 5aa15f2 commit 7b67695

5 files changed

Lines changed: 7 additions & 6 deletions

middleware/archived-enterprise-versions-assets.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ module.exports = async (req, res, next) => {
3030
res.set('x-robots-tag', 'noindex')
3131
// Allow the browser and Fastly to cache these
3232
res.set('cache-control', `public, max-age=${ONE_DAY}`)
33-
res.send(r.body)
33+
return res.send(r.body)
3434
} catch (err) {
35-
next()
35+
return next()
3636
}
3737
}

middleware/archived-enterprise-versions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ module.exports = async (req, res, next) => {
4646
res.set('location', staticRedirect[1])
4747
}
4848

49-
res.send(r.body)
49+
return res.send(r.body)
5050
} catch (err) {
5151
for (const fallbackRedirect of getFallbackRedirects(req, requestedVersion) || []) {
5252
try {
5353
await got(getProxyPath(fallbackRedirect, requestedVersion))
5454
return res.redirect(301, fallbackRedirect)
5555
} catch (err) { } // noop
5656
}
57-
next()
57+
return next()
5858
}
5959
}
6060

middleware/disable-caching-on-safari.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ module.exports = (req, res, next) => {
33
if (isSafari) {
44
res.header('Last-Modified', (new Date()).toUTCString())
55
}
6-
next()
6+
return next()
77
}

middleware/render-page.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ module.exports = async function renderPage (req, res, next) {
115115
const output = await liquid.parseAndRender(layout, context)
116116

117117
// First, send the response so the user isn't waiting
118+
// NOTE: Do NOT `return` here as we still need to cache the response afterward!
118119
res.send(output)
119120

120121
// Finally, save output to cache for the next time around

middleware/set-fastly-surrogate-key.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ module.exports = (req, res, next) => {
88
// https://docs.fastly.com/en/guides/getting-started-with-surrogate-keys
99
res.set('surrogate-key', 'all-the-things')
1010

11-
next()
11+
return next()
1212
}

0 commit comments

Comments
 (0)