2026-05-22 14:26:13 +00:00
|
|
|
export function badRequest(message: string): Response {
|
|
|
|
|
return new Response(JSON.stringify({ error: message }), {
|
|
|
|
|
status: 400,
|
|
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-22 16:08:18 +00:00
|
|
|
export function unauthorized(message: string): Response {
|
|
|
|
|
return new Response(JSON.stringify({ error: message }), {
|
|
|
|
|
status: 401,
|
|
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function forbidden(message: string): Response {
|
|
|
|
|
return new Response(JSON.stringify({ error: message }), {
|
|
|
|
|
status: 403,
|
|
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-22 14:26:13 +00:00
|
|
|
export function notFound(message: string): Response {
|
|
|
|
|
return new Response(JSON.stringify({ error: message }), {
|
|
|
|
|
status: 404,
|
|
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-22 15:13:22 +00:00
|
|
|
export function badGateway(message: string): Response {
|
|
|
|
|
return new Response(JSON.stringify({ error: message }), {
|
|
|
|
|
status: 502,
|
|
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-22 14:26:13 +00:00
|
|
|
export function serviceUnavailable(message: string): Response {
|
|
|
|
|
return new Response(JSON.stringify({ error: message }), {
|
|
|
|
|
status: 503,
|
|
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
|
|
});
|
|
|
|
|
}
|