diff --git a/src/server/rendering/template.tsx b/src/server/rendering/template.tsx index d3af8fa6..ea948f17 100644 --- a/src/server/rendering/template.tsx +++ b/src/server/rendering/template.tsx @@ -94,11 +94,11 @@ export function renderOuterDocument( h("script", { src: src, nonce, type: "module" }) ), headVNodes, - h("body", { - ...docBody, - dangerouslySetInnerHTML: { __html: opts.bodyHtml }, - }), ), + h("body", { + ...docBody, + dangerouslySetInnerHTML: { __html: opts.bodyHtml }, + }), ); try { diff --git a/tests/explicit_app_template_test.ts b/tests/explicit_app_template_test.ts index 5d1c5130..731f1924 100644 --- a/tests/explicit_app_template_test.ts +++ b/tests/explicit_app_template_test.ts @@ -5,6 +5,7 @@ import { fetchHtml, withFresh, } from "$fresh/tests/test_utils.ts"; +import { assertNotMatch } from "$std/testing/asserts.ts"; Deno.test("doesn't apply internal app template", async () => { await withFresh( @@ -78,3 +79,16 @@ Deno.test("sets + + classes", async () => { }, ); }); + +// Issue: https://github.com/denoland/fresh/issues/1666 +Deno.test("renders valid html document", async () => { + await withFresh( + "./tests/fixture_explicit_app/main.ts", + async (address) => { + const res = await fetch(address); + const text = await res.text(); + + assertNotMatch(text, /<\/body><\/head>/); + }, + ); +});