Skip to content

Commit

Permalink
fix(examples/cms-contentful): add correct Content-Type + missing clos…
Browse files Browse the repository at this point in the history
…ing tag for html
  • Loading branch information
Guillaume FORTAINE authored and gfortaine committed Jan 4, 2022
1 parent cfa8ab9 commit 7d6a3e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/cms-contentful/pages/api/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ export default async function preview(req, res) {
// We don't redirect to req.query.slug as that might lead to open redirect vulnerabilities
// res.writeHead(307, { Location: `/posts/${post.slug}` })
const url = `/posts/${post.slug}`
res.setHeader('Content-Type', 'text/html')
res.write(
`<!DOCTYPE html><html><head><meta http-equiv="Refresh" content="0; url=${url}" />
<script>window.location.href = '${url}'</script>
</head>`
</head>
</html>`
)
res.end()
}

0 comments on commit 7d6a3e4

Please sign in to comment.