Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored and astrobot-houston committed Jun 24, 2024
1 parent 44c61dd commit 7c59f04
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
11 changes: 5 additions & 6 deletions packages/astro/src/runtime/server/render/page.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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 });

}
}
12 changes: 8 additions & 4 deletions packages/astro/test/custom-404-implicit-rerouting.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
);
});
});
}
1 change: 0 additions & 1 deletion packages/astro/test/rewrite.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ describe('Middleware', () => {
});
});


describe('Middleware with custom 404.astro and 500.astro', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
Expand Down

0 comments on commit 7c59f04

Please sign in to comment.