MCPcopy
hub / github.com/github/docs / setFastlySurrogateKey

Function setFastlySurrogateKey

middleware/set-fastly-surrogate-key.js:17–26  ·  view source on GitHub ↗
(res, enumKey, isCustomKey = false)

Source from the content-addressed store, hash-verified

15}
16
17export function setFastlySurrogateKey(res, enumKey, isCustomKey = false) {
18 if (process.env.NODE_ENV !== 'production') {
19 if (!isCustomKey && !Object.values(SURROGATE_ENUMS).includes(enumKey)) {
20 throw new Error(
21 `Unrecognizes surrogate enumKey. ${enumKey} is not one of ${Object.values(SURROGATE_ENUMS)}`
22 )
23 }
24 }
25 res.set(KEY, enumKey)
26}
27
28export function setDefaultFastlySurrogateKey(req, res, next) {
29 res.set(KEY, `${SURROGATE_ENUMS.DEFAULT} ${makeLanguageSurrogateKey()}`)

Callers 7

faviconsFunction · 0.90
handleErrorFunction · 0.90
cacheAggressivelyFunction · 0.90
dynamicAssetsFunction · 0.90
setStaticAssetCachingFunction · 0.90
search.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected