Skip to content

Commit

Permalink
feat: add X-Nitro-Prerender header to detect prerendering
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed May 5, 2022
1 parent 9423524 commit 11e732b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function prerender (nitro: Nitro) {
if (!canPrerender(route)) { return }
generatedRoutes.add(route)
routes.delete(route)
const res = await (localFetch(route) as ReturnType<typeof fetch>)
const res = await (localFetch(route, { headers: { 'X-Nitro-Prerender': route } }) as ReturnType<typeof fetch>)
const contents = await res.text()
if (res.status !== 200) {
throw new Error(`[${res.status}] ${res.statusText}`)
Expand Down

0 comments on commit 11e732b

Please sign in to comment.