full site update
This commit is contained in:
30
node_modules/astro/dist/vite-plugin-astro-server/response.js
generated
vendored
30
node_modules/astro/dist/vite-plugin-astro-server/response.js
generated
vendored
@@ -2,17 +2,7 @@ import { Http2ServerResponse } from "node:http2";
|
||||
import { Readable } from "node:stream";
|
||||
import { getSetCookiesFromResponse } from "../core/cookies/index.js";
|
||||
import { getViteErrorPayload } from "../core/errors/dev/index.js";
|
||||
import notFoundTemplate from "../template/4xx.js";
|
||||
async function handle404Response(origin, req, res) {
|
||||
const pathname = decodeURI(new URL(origin + req.url).pathname);
|
||||
const html = notFoundTemplate({
|
||||
statusCode: 404,
|
||||
title: "Not found",
|
||||
tabTitle: "404: Not Found",
|
||||
pathname
|
||||
});
|
||||
writeHtmlResponse(res, 404, html);
|
||||
}
|
||||
import { redirectTemplate } from "../core/routing/3xx.js";
|
||||
async function handle500Response(loader, res, err) {
|
||||
res.on(
|
||||
"close",
|
||||
@@ -31,7 +21,21 @@ async function handle500Response(loader, res, err) {
|
||||
}
|
||||
function writeHtmlResponse(res, statusCode, html) {
|
||||
res.writeHead(statusCode, {
|
||||
"Content-Type": "text/html; charset=utf-8",
|
||||
"Content-Type": "text/html",
|
||||
"Content-Length": Buffer.byteLength(html, "utf-8")
|
||||
});
|
||||
res.write(html);
|
||||
res.end();
|
||||
}
|
||||
function writeRedirectResponse(res, statusCode, location) {
|
||||
const html = redirectTemplate({
|
||||
status: statusCode,
|
||||
absoluteLocation: location,
|
||||
relativeLocation: location
|
||||
});
|
||||
res.writeHead(statusCode, {
|
||||
Location: location,
|
||||
"Content-Type": "text/html",
|
||||
"Content-Length": Buffer.byteLength(html, "utf-8")
|
||||
});
|
||||
res.write(html);
|
||||
@@ -84,9 +88,9 @@ async function writeSSRResult(webRequest, webResponse, res) {
|
||||
return writeWebResponse(res, webResponse);
|
||||
}
|
||||
export {
|
||||
handle404Response,
|
||||
handle500Response,
|
||||
writeHtmlResponse,
|
||||
writeRedirectResponse,
|
||||
writeSSRResult,
|
||||
writeWebResponse
|
||||
};
|
||||
|
Reference in New Issue
Block a user