From 11e732b6d3c53ca2d8b7e09be9f0da4550eb5d0c Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 5 May 2022 23:25:30 +0200 Subject: [PATCH] feat: add `X-Nitro-Prerender` header to detect prerendering --- src/prerender.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/prerender.ts b/src/prerender.ts index 60ac97fbd7..4e04d67c5c 100644 --- a/src/prerender.ts +++ b/src/prerender.ts @@ -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) + const res = await (localFetch(route, { headers: { 'X-Nitro-Prerender': route } }) as ReturnType) const contents = await res.text() if (res.status !== 200) { throw new Error(`[${res.status}] ${res.statusText}`)