diff options
author | 2022-07-22 20:32:12 +0000 | |
---|---|---|
committer | 2022-07-22 20:32:12 +0000 | |
commit | c17efc1ad9389ae7d6a83bcd3d44fc4af487106a (patch) | |
tree | 293641fa56e0b320c05f9612d5ca635c9f400f09 | |
parent | 0cc6ede362996b9faba57481a790d6eb7fba2045 (diff) | |
download | astro-c17efc1ad9389ae7d6a83bcd3d44fc4af487106a.tar.gz astro-c17efc1ad9389ae7d6a83bcd3d44fc4af487106a.tar.zst astro-c17efc1ad9389ae7d6a83bcd3d44fc4af487106a.zip |
[ci] format
-rw-r--r-- | packages/astro/src/core/app/index.ts | 19 | ||||
-rw-r--r-- | packages/astro/src/core/endpoint/index.ts | 11 | ||||
-rw-r--r-- | packages/astro/src/core/render/core.ts | 4 | ||||
-rw-r--r-- | packages/astro/test/ssr-404-500-pages.test.js | 2 |
4 files changed, 25 insertions, 11 deletions
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<Response> { site, ssr, streaming, - status = 200 + status = 200, } = opts; const paramsAndPropsRes = await getParamsAndProps({ @@ -150,7 +150,7 @@ export async function render(opts: RenderOptions): Promise<Response> { 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 () => { |