VYBECODEDDDDDDDDD

This commit is contained in:
Anaïs Saraiva
2026-08-15 00:20:45 +02:00
parent 1a2c8aaf7c
commit 5f201cf725
23 changed files with 2263 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
export function securityHeaders(): Record<string, string> {
return {
"x-content-type-options": "nosniff",
"referrer-policy": "no-referrer",
};
}
export function json(data: unknown, status = 200, headers: Record<string, string> = {}): Response {
return new Response(JSON.stringify(data), {
status,
headers: { "content-type": "application/json; charset=utf-8", ...securityHeaders(), ...headers },
});
}
export function jsonError(status: number, message: string): Response {
return json({ error: message }, status);
}
export function notFound(): Response {
return jsonError(404, "not found");
}