fix header lengths

This commit is contained in:
Chris Wanstrath 2026-01-30 20:33:39 -08:00
parent 5ed8673274
commit 834ae8623a

View File

@ -127,7 +127,9 @@ export class Hype<
const res = c.res.clone() const res = c.res.clone()
const html = await res.text() const html = await res.text()
const formatted = formatHTML(html) const formatted = formatHTML(html)
c.res = new Response(formatted, c.res) const headers = new Headers(c.res.headers)
headers.delete('content-length')
c.res = new Response(formatted, { status: c.res.status, headers })
}) })
} }
} }
@ -150,8 +152,9 @@ export class Hype<
const res = c.res.clone() const res = c.res.clone()
const html = await res.text() const html = await res.text()
const newHtml = html.replace('</body>', `<script>${fns.join('\n')}</script></body>`) const newHtml = html.replace('</body>', `<script>${fns.join('\n')}</script></body>`)
const headers = new Headers(c.res.headers)
c.res = new Response(newHtml, c.res) headers.delete('content-length')
c.res = new Response(newHtml, { status: c.res.status, headers })
}) })
}) })