File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
packages/astro/src/core/app Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ export class App {
273273 }
274274
275275 /**
276- * If is a known error code, try sending the according page (e.g. 404.astro / 500.astro).
276+ * If it is a known error code, try sending the according page (e.g. 404.astro / 500.astro).
277277 * This also handles pre-rendered /404 or /500 routes
278278 */
279279 async #renderError(
@@ -319,8 +319,10 @@ export class App {
319319 const { status, statusText, headers } = oldResponse ;
320320
321321 return new Response ( newResponse . body , {
322+ // If the original status was 200 (default), override it with the new status (probably 404 or 500)
323+ // Otherwise, the user set a specific status while rendering and we should respect that one
322324 status : status === 200 ? newResponse . status : status ,
323- statusText,
325+ statusText : status === 200 ? newResponse . statusText : statusText ,
324326 headers : new Headers ( Array . from ( headers ) ) ,
325327 } ) ;
326328 }
You can’t perform that action at this time.
0 commit comments