21 lines
590 B
TypeScript
21 lines
590 B
TypeScript
export function badRequest(message: string): Response {
|
|||
|
|
return new Response(JSON.stringify({ error: message }), {
|
||
|
|
status: 400,
|
||
|
|
headers: { 'Content-Type': 'application/json' },
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
export function notFound(message: string): Response {
|
||
|
|
return new Response(JSON.stringify({ error: message }), {
|
||
|
|
status: 404,
|
||
|
|
headers: { 'Content-Type': 'application/json' },
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
export function serviceUnavailable(message: string): Response {
|
||
|
|
return new Response(JSON.stringify({ error: message }), {
|
||
|
|
status: 503,
|
||
|
|
headers: { 'Content-Type': 'application/json' },
|
||
|
|
});
|
||
|
|
}
|