0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-17 22:44:24 -05:00

[ci] format

This commit is contained in:
Arsh 2024-01-23 14:04:53 +00:00 committed by astrobot-houston
parent 075706f26d
commit 17f27e7ceb
3 changed files with 9 additions and 12 deletions

View file

@ -276,15 +276,18 @@ export class App {
return this.#renderError(request, { status: 500 }); return this.#renderError(request, { status: 500 });
} }
if (REROUTABLE_STATUS_CODES.has(response.status) && response.headers.get("X-Astro-Reroute") !== "no") { if (
REROUTABLE_STATUS_CODES.has(response.status) &&
response.headers.get('X-Astro-Reroute') !== 'no'
) {
return this.#renderError(request, { return this.#renderError(request, {
response, response,
status: response.status as 404 | 500, status: response.status as 404 | 500,
}); });
} }
if (response.headers.has("X-Astro-Reroute")) { if (response.headers.has('X-Astro-Reroute')) {
response.headers.delete("X-Astro-Reroute"); response.headers.delete('X-Astro-Reroute');
} }
if (addCookieHeader) { if (addCookieHeader) {
@ -292,7 +295,7 @@ export class App {
response.headers.append('set-cookie', setCookieHeaderValue); response.headers.append('set-cookie', setCookieHeaderValue);
} }
} }
Reflect.set(response, responseSentSymbol, true); Reflect.set(response, responseSentSymbol, true);
return response; return response;
} }

View file

@ -4,7 +4,6 @@ import { callMiddleware } from './middleware/callMiddleware.js';
import { renderPage } from './render/core.js'; import { renderPage } from './render/core.js';
import { type Environment, type RenderContext } from './render/index.js'; import { type Environment, type RenderContext } from './render/index.js';
type PipelineHooks = { type PipelineHooks = {
before: PipelineHookFunction[]; before: PipelineHookFunction[];
}; };
@ -63,12 +62,7 @@ export class Pipeline {
for (const hook of this.#hooks.before) { for (const hook of this.#hooks.before) {
hook(renderContext, componentInstance); hook(renderContext, componentInstance);
} }
return await this.#tryRenderRoute( return await this.#tryRenderRoute(renderContext, this.env, componentInstance, this.#onRequest);
renderContext,
this.env,
componentInstance,
this.#onRequest
);
} }
/** /**

View file

@ -41,6 +41,6 @@ export async function renderEndpoint(
const response = await handler.call(mod, context); const response = await handler.call(mod, context);
// Endpoints explicitly returning 404 or 500 response status should // Endpoints explicitly returning 404 or 500 response status should
// NOT be subject to rerouting to 404.astro or 500.astro. // NOT be subject to rerouting to 404.astro or 500.astro.
response.headers.set("X-Astro-Reroute", "no"); response.headers.set('X-Astro-Reroute', 'no');
return response; return response;
} }