Skip to content

Commit

Permalink
fix: revert!
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Oct 11, 2022
1 parent 4cf4a83 commit afc39f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/presets/netlify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async function writeRedirects (nitro: Nitro) {

for (const [key, value] of Object.entries(nitro.options.routes).filter(([_, value]) => value.redirect)) {
const redirect = typeof value.redirect === 'string' ? { to: value.redirect } : value.redirect
// TODO: update to 307 when netlify support 307/308 redirects
// TODO: update to 307 when netlify support 307/308
contents = `${key.replace('/**', '/*')}\t${redirect.to}\t${redirect.statusCode || 301}\n` + contents
}

Expand All @@ -104,7 +104,7 @@ async function writeHeaders (nitro: Nitro) {
let contents = ''

for (const [key, value] of Object.entries(nitro.options.routes).filter(([_, value]) => value.cors || value.headers)) {
contents = [
const headers = [
key.replace('/**', '/*'),
...Object.entries({
...value.cors
Expand All @@ -118,6 +118,8 @@ async function writeHeaders (nitro: Nitro) {
...value.headers || {}
}).map(([header, value]) => ` ${header}: ${value}`)
].join('\n')

contents += headers + '\n'
}

if (existsSync(headersPath)) {
Expand Down

0 comments on commit afc39f5

Please sign in to comment.