mirror of
https://github.com/withastro/astro.git
synced 2025-02-17 22:44:24 -05:00
[ci] format
This commit is contained in:
parent
075706f26d
commit
17f27e7ceb
3 changed files with 9 additions and 12 deletions
|
@ -276,15 +276,18 @@ export class App {
|
|||
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, {
|
||||
response,
|
||||
status: response.status as 404 | 500,
|
||||
});
|
||||
}
|
||||
|
||||
if (response.headers.has("X-Astro-Reroute")) {
|
||||
response.headers.delete("X-Astro-Reroute");
|
||||
if (response.headers.has('X-Astro-Reroute')) {
|
||||
response.headers.delete('X-Astro-Reroute');
|
||||
}
|
||||
|
||||
if (addCookieHeader) {
|
||||
|
@ -292,7 +295,7 @@ export class App {
|
|||
response.headers.append('set-cookie', setCookieHeaderValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reflect.set(response, responseSentSymbol, true);
|
||||
return response;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import { callMiddleware } from './middleware/callMiddleware.js';
|
|||
import { renderPage } from './render/core.js';
|
||||
import { type Environment, type RenderContext } from './render/index.js';
|
||||
|
||||
|
||||
type PipelineHooks = {
|
||||
before: PipelineHookFunction[];
|
||||
};
|
||||
|
@ -63,12 +62,7 @@ export class Pipeline {
|
|||
for (const hook of this.#hooks.before) {
|
||||
hook(renderContext, componentInstance);
|
||||
}
|
||||
return await this.#tryRenderRoute(
|
||||
renderContext,
|
||||
this.env,
|
||||
componentInstance,
|
||||
this.#onRequest
|
||||
);
|
||||
return await this.#tryRenderRoute(renderContext, this.env, componentInstance, this.#onRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,6 +41,6 @@ export async function renderEndpoint(
|
|||
const response = await handler.call(mod, context);
|
||||
// Endpoints explicitly returning 404 or 500 response status should
|
||||
// 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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue