Skip to content

Commit 4cc4438

Browse files
author
Guillaume FORTAINE
committed
fix(examples/cms-contentful): add correct Content-Type + missing closing tag for html
1 parent 8b85801 commit 4cc4438

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/cms-contentful/pages/api/preview.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ export default async function preview(req, res) {
2222
// We don't redirect to req.query.slug as that might lead to open redirect vulnerabilities
2323
// res.writeHead(307, { Location: `/posts/${post.slug}` })
2424
const url = `/posts/${post.slug}`
25+
res.setHeader('Content-Type', 'text/html');
2526
res.write(
2627
`<!DOCTYPE html><html><head><meta http-equiv="Refresh" content="0; url=${url}" />
2728
<script>window.location.href = '${url}'</script>
28-
</head>`
29+
</head>
30+
</html>`
2931
)
3032
res.end()
3133
}

0 commit comments

Comments
 (0)