mirror of
https://github.com/withastro/astro.git
synced 2025-01-27 22:19:04 -05:00
[ci] format
This commit is contained in:
parent
bbf1d8894e
commit
df90e6dfad
2 changed files with 6 additions and 3 deletions
|
@ -6,8 +6,8 @@ import type { ModuleLoader } from '../core/module-loader/index.js';
|
||||||
import { Readable } from 'node:stream';
|
import { Readable } from 'node:stream';
|
||||||
import { getSetCookiesFromResponse } from '../core/cookies/index.js';
|
import { getSetCookiesFromResponse } from '../core/cookies/index.js';
|
||||||
import { getViteErrorPayload } from '../core/errors/dev/index.js';
|
import { getViteErrorPayload } from '../core/errors/dev/index.js';
|
||||||
import notFoundTemplate from '../template/4xx.js';
|
|
||||||
import { redirectTemplate } from '../core/routing/3xx.js';
|
import { redirectTemplate } from '../core/routing/3xx.js';
|
||||||
|
import notFoundTemplate from '../template/4xx.js';
|
||||||
|
|
||||||
export async function handle404Response(
|
export async function handle404Response(
|
||||||
origin: string,
|
origin: string,
|
||||||
|
@ -54,7 +54,11 @@ export function writeHtmlResponse(res: http.ServerResponse, statusCode: number,
|
||||||
res.end();
|
res.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function writeRedirectResponse(res: http.ServerResponse, statusCode: number, location: string) {
|
export function writeRedirectResponse(
|
||||||
|
res: http.ServerResponse,
|
||||||
|
statusCode: number,
|
||||||
|
location: string,
|
||||||
|
) {
|
||||||
const html = redirectTemplate({ status: statusCode, location });
|
const html = redirectTemplate({ status: statusCode, location });
|
||||||
res.writeHead(statusCode, {
|
res.writeHead(statusCode, {
|
||||||
Location: location,
|
Location: location,
|
||||||
|
|
|
@ -60,7 +60,6 @@ describe('Development Routing', () => {
|
||||||
assert.equal(response.headers.get('Location'), '/');
|
assert.equal(response.headers.get('Location'), '/');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('404 when loading invalid dynamic route', async () => {
|
it('404 when loading invalid dynamic route', async () => {
|
||||||
const response = await fixture.fetch('/2');
|
const response = await fixture.fetch('/2');
|
||||||
assert.equal(response.status, 404);
|
assert.equal(response.status, 404);
|
||||||
|
|
Loading…
Add table
Reference in a new issue