mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
[ci] format
This commit is contained in:
parent
44c61ddfd8
commit
7c59f043b2
3 changed files with 13 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
import type {AstroConfig, RouteData, SSRResult} from '../../../@types/astro.js';
|
||||
import type { AstroConfig, RouteData, SSRResult } from '../../../@types/astro.js';
|
||||
import { type NonAstroPageComponent, renderComponentToString } from './component.js';
|
||||
import type { AstroComponentFactory } from './index.js';
|
||||
|
||||
|
@ -87,15 +87,14 @@ export async function renderPage(
|
|||
}
|
||||
let status = init.status;
|
||||
// Custom 404.astro and 500.astro are particular routes that must return a fixed status code
|
||||
if (route?.route === "/404") {
|
||||
status = 404
|
||||
} else if (route?.route === "/500") {
|
||||
status = 500
|
||||
if (route?.route === '/404') {
|
||||
status = 404;
|
||||
} else if (route?.route === '/500') {
|
||||
status = 500;
|
||||
}
|
||||
if (status) {
|
||||
return new Response(body, { ...init, headers, status });
|
||||
} else {
|
||||
return new Response(body, { ...init, headers });
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,10 +58,14 @@ for (const caseNumber of [1, 2, 3, 4, 5]) {
|
|||
});
|
||||
|
||||
// IMPORTANT: never skip
|
||||
it('prod server stays responsive for case number ' + caseNumber, { timeout: 1000 }, async () => {
|
||||
const response = await app.render(new Request('https://example.com/alvsibdlvjks'));
|
||||
assert.equal(response.status, 404);
|
||||
});
|
||||
it(
|
||||
'prod server stays responsive for case number ' + caseNumber,
|
||||
{ timeout: 1000 },
|
||||
async () => {
|
||||
const response = await app.render(new Request('https://example.com/alvsibdlvjks'));
|
||||
assert.equal(response.status, 404);
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -390,7 +390,6 @@ describe('Middleware', () => {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
describe('Middleware with custom 404.astro and 500.astro', () => {
|
||||
/** @type {import('./test-utils').Fixture} */
|
||||
let fixture;
|
||||
|
|
Loading…
Reference in a new issue