mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-14 20:53:43 +01:00
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
const reasons: Record<number, string> = {
|
|
100: "Continue",
|
|
101: "Switching Protocols",
|
|
200: "OK",
|
|
201: "Created",
|
|
202: "Accepted",
|
|
204: "No Content",
|
|
206: "Partial Content",
|
|
301: "Moved Permanently",
|
|
302: "Found",
|
|
303: "See Other",
|
|
304: "Not Modified",
|
|
307: "Temporary Redirect",
|
|
308: "Permanent Redirect",
|
|
400: "Bad Request",
|
|
401: "Unauthorized",
|
|
402: "Payment Required",
|
|
403: "Forbidden",
|
|
404: "Not Found",
|
|
405: "Method Not Allowed",
|
|
406: "Not Acceptable",
|
|
408: "Request Timeout",
|
|
409: "Conflict",
|
|
410: "Gone",
|
|
412: "Precondition Failed",
|
|
413: "Content Too Large",
|
|
415: "Unsupported Media Type",
|
|
418: "I'm a teapot",
|
|
422: "Unprocessable Content",
|
|
429: "Too Many Requests",
|
|
500: "Internal Server Error",
|
|
501: "Not Implemented",
|
|
502: "Bad Gateway",
|
|
503: "Service Unavailable",
|
|
504: "Gateway Timeout",
|
|
};
|
|
|
|
/** The engine records the status code only, so the reason is the standard one */
|
|
export function statusReason(status: number): string | null {
|
|
return reasons[status] ?? null;
|
|
}
|