Files
next.js/test/integration/image-optimizer/app/pages/api/conditional-cookie.js
StevenandGitHub 6b12c60c61 fix(next/image): fix image-optimizer.ts headers (#82114)
The headers were forwarded to the serverless function for "internal"
images but not "external" images.

This changes the behavior to be the same for both such that neither
receive headers.
2025-07-28 13:06:33 +00:00

12 lines
345 B
JavaScript

const pixel =
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg=='
export default function handler(req, res) {
if (req.headers['cookie']) {
res.setHeader('content-type', 'image/png')
res.end(Buffer.from(pixel, 'base64'))
} else {
res.status(401).end('cookie was not found')
}
}