disable early hints when there is no environment value set for it

This commit is contained in:
Ulf Gebhardt 2024-03-14 12:28:08 +01:00
parent 9cf9ff7258
commit 29e7be74f5
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -80,7 +80,7 @@ async function startServer() {
next()
} else {
const { body, statusCode, headers, earlyHints } = httpResponse
if (res.writeEarlyHints)
if (process.env.EARLY_HINTS && res.writeEarlyHints)
res.writeEarlyHints({ link: earlyHints.map((e) => e.earlyHintLink) })
headers.forEach(([name, value]) => res.setHeader(name, value))
res.status(statusCode)