HttpStatusCode.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. const HttpStatusCode = {
  2. Continue: 100,
  3. SwitchingProtocols: 101,
  4. Processing: 102,
  5. EarlyHints: 103,
  6. Ok: 200,
  7. Created: 201,
  8. Accepted: 202,
  9. NonAuthoritativeInformation: 203,
  10. NoContent: 204,
  11. ResetContent: 205,
  12. PartialContent: 206,
  13. MultiStatus: 207,
  14. AlreadyReported: 208,
  15. ImUsed: 226,
  16. MultipleChoices: 300,
  17. MovedPermanently: 301,
  18. Found: 302,
  19. SeeOther: 303,
  20. NotModified: 304,
  21. UseProxy: 305,
  22. Unused: 306,
  23. TemporaryRedirect: 307,
  24. PermanentRedirect: 308,
  25. BadRequest: 400,
  26. Unauthorized: 401,
  27. PaymentRequired: 402,
  28. Forbidden: 403,
  29. NotFound: 404,
  30. MethodNotAllowed: 405,
  31. NotAcceptable: 406,
  32. ProxyAuthenticationRequired: 407,
  33. RequestTimeout: 408,
  34. Conflict: 409,
  35. Gone: 410,
  36. LengthRequired: 411,
  37. PreconditionFailed: 412,
  38. /**
  39. * @deprecated Use `ContentTooLarge` instead.
  40. */
  41. PayloadTooLarge: 413,
  42. ContentTooLarge: 413,
  43. UriTooLong: 414,
  44. UnsupportedMediaType: 415,
  45. RangeNotSatisfiable: 416,
  46. ExpectationFailed: 417,
  47. ImATeapot: 418,
  48. MisdirectedRequest: 421,
  49. /**
  50. * @deprecated Use `UnprocessableContent` instead.
  51. */
  52. UnprocessableEntity: 422,
  53. UnprocessableContent: 422,
  54. Locked: 423,
  55. FailedDependency: 424,
  56. TooEarly: 425,
  57. UpgradeRequired: 426,
  58. PreconditionRequired: 428,
  59. TooManyRequests: 429,
  60. RequestHeaderFieldsTooLarge: 431,
  61. UnavailableForLegalReasons: 451,
  62. InternalServerError: 500,
  63. NotImplemented: 501,
  64. BadGateway: 502,
  65. ServiceUnavailable: 503,
  66. GatewayTimeout: 504,
  67. HttpVersionNotSupported: 505,
  68. VariantAlsoNegotiates: 506,
  69. InsufficientStorage: 507,
  70. LoopDetected: 508,
  71. NotExtended: 510,
  72. NetworkAuthenticationRequired: 511,
  73. WebServerReturnsAnUnknownError: 520,
  74. WebServerIsDown: 521,
  75. ConnectionTimedOut: 522,
  76. OriginIsUnreachable: 523,
  77. TimeoutOccurred: 524,
  78. SslHandshakeFailed: 525,
  79. InvalidSslCertificate: 526,
  80. };
  81. Object.entries(HttpStatusCode).forEach(([key, value]) => {
  82. if (HttpStatusCode[value] === undefined) {
  83. HttpStatusCode[value] = key;
  84. }
  85. });
  86. export default HttpStatusCode;