http-status.ts
This file
Path
src/utils/http-status.ts
72 lines 路 1.4 KiB 路 TypeScript
Last changed by
Not known.
History of this fileTake it
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273/** * @module * HTTP Status utility. */
export type InfoStatusCode = 100 | 101 | 102 | 103export type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226export type DeprecatedStatusCode = 305 | 306export type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308export type ClientErrorStatusCode = | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451export type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511
/** * `UnofficialStatusCode` can be used to specify an unofficial status code. * @example * * ```ts * app.get('/unknown', (c) => { * return c.text("Unknown Error", 520 as UnofficialStatusCode) * }) * ``` */export type UnofficialStatusCode = -1
/** * @deprecated * Use `UnofficialStatusCode` instead. */export type UnOfficalStatusCode = UnofficialStatusCode
/** * If you want to use an unofficial status, use `UnofficialStatusCode`. */export type StatusCode = | InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | UnofficialStatusCode
export type ContentlessStatusCode = 101 | 204 | 205 | 304export type ContentfulStatusCode = Exclude<StatusCode, ContentlessStatusCode>