Unverified Commit 4a2bfa7a authored by Guillaume FORTAINE's avatar Guillaume FORTAINE Committed by GitHub

fix(examples/cms-contentful): add correct Content-Type + missing closing tag for html (#30321)



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
parent 1ee13baf
...@@ -22,10 +22,12 @@ export default async function preview(req, res) { ...@@ -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 // We don't redirect to req.query.slug as that might lead to open redirect vulnerabilities
// res.writeHead(307, { Location: `/posts/${post.slug}` }) // res.writeHead(307, { Location: `/posts/${post.slug}` })
const url = `/posts/${post.slug}` const url = `/posts/${post.slug}`
res.setHeader('Content-Type', 'text/html')
res.write( res.write(
`<!DOCTYPE html><html><head><meta http-equiv="Refresh" content="0; url=${url}" /> `<!DOCTYPE html><html><head><meta http-equiv="Refresh" content="0; url=${url}" />
<script>window.location.href = '${url}'</script> <script>window.location.href = '${url}'</script>
</head>` </head>
</html>`
) )
res.end() res.end()
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment