diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts index 7adde8820..a7b902dd3 100644 --- a/packages/astro/src/core/app/index.ts +++ b/packages/astro/src/core/app/index.ts @@ -58,9 +58,9 @@ export class App { } let routeData = matchRoute(url.pathname, this.#manifestData); - if(routeData) { + if (routeData) { return routeData; - } else if(matchNotFound) { + } else if (matchNotFound) { return matchRoute('/404', this.#manifestData); } else { return undefined; @@ -88,12 +88,17 @@ export class App { let response = await this.#renderPage(request, routeData, mod, defaultStatus); // If there was a 500 error, try sending the 500 page. - if(response.status === 500) { + if (response.status === 500) { const fiveHundredRouteData = matchRoute('/500', this.#manifestData); - if(fiveHundredRouteData) { + if (fiveHundredRouteData) { mod = this.#manifest.pageMap.get(fiveHundredRouteData.component)!; try { - let fiveHundredResponse = await this.#renderPage(request, fiveHundredRouteData, mod, 500); + let fiveHundredResponse = await this.#renderPage( + request, + fiveHundredRouteData, + mod, + 500 + ); return fiveHundredResponse; } catch {} } @@ -159,7 +164,7 @@ export class App { ssr: true, request, streaming: this.#streaming, - status + status, }); return response; @@ -188,7 +193,7 @@ export class App { route: routeData, routeCache: this.#routeCache, ssr: true, - status + status, }); if (result.type === 'response') { diff --git a/packages/astro/src/core/endpoint/index.ts b/packages/astro/src/core/endpoint/index.ts index 117953dac..9e974ee36 100644 --- a/packages/astro/src/core/endpoint/index.ts +++ b/packages/astro/src/core/endpoint/index.ts @@ -5,7 +5,16 @@ import { getParamsAndProps, GetParamsAndPropsError } from '../render/core.js'; export type EndpointOptions = Pick< RenderOptions, - 'logging' | 'origin' | 'request' | 'route' | 'routeCache' | 'pathname' | 'route' | 'site' | 'ssr' | 'status' + | 'logging' + | 'origin' + | 'request' + | 'route' + | 'routeCache' + | 'pathname' + | 'route' + | 'site' + | 'ssr' + | 'status' >; type EndpointCallResult = diff --git a/packages/astro/src/core/render/core.ts b/packages/astro/src/core/render/core.ts index 94aa62ac8..231088fa7 100644 --- a/packages/astro/src/core/render/core.ts +++ b/packages/astro/src/core/render/core.ts @@ -108,7 +108,7 @@ export async function render(opts: RenderOptions): Promise { site, ssr, streaming, - status = 200 + status = 200, } = opts; const paramsAndPropsRes = await getParamsAndProps({ @@ -150,7 +150,7 @@ export async function render(opts: RenderOptions): Promise { scripts, ssr, streaming, - status + status, }); // Support `export const components` for `MDX` pages diff --git a/packages/astro/test/ssr-404-500-pages.test.js b/packages/astro/test/ssr-404-500-pages.test.js index 45d60d4ba..37ff3d3a5 100644 --- a/packages/astro/test/ssr-404-500-pages.test.js +++ b/packages/astro/test/ssr-404-500-pages.test.js @@ -15,7 +15,7 @@ describe('404 and 500 pages', () => { }, adapter: testAdapter(), }); - await fixture.build({ }); + await fixture.build({}); }); it('404 page returned when a route does not match', async () => {