fix(docs): call writeHead before write and remove next() (#332)

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Makito
2025-07-29 23:44:15 +08:00
committed by GitHub
co-authored by gemini-code-assist[bot]
parent 08c86ee192
commit 3eac6f9901
@@ -155,15 +155,13 @@ export function frontmatterAssets(): Plugin {
const ext = parse(filePath).ext.slice(1)
const fileContent = await readFile(filePath)
res.write(fileContent)
res.writeHead(200, {
'Content-Type': ext === 'svg' ? 'image/svg+xml' : `image/${ext}`,
'Content-Length': fileContent.length,
'Cache-Control': 'public, max-age=31536000, immutable',
})
res.end(fileContent)
res.end()
return next()
})
},
async writeBundle() {