另客网go项目公用的代码库

status.go 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. package linker
  2. // linker status codes as registered.
  3. const (
  4. StatusContinue = 100 // RFC 7231, 6.2.1
  5. StatusSwitchingProtocols = 101 // RFC 7231, 6.2.2
  6. StatusProcessing = 102 // RFC 2518, 10.1
  7. StatusOK = 200 // RFC 7231, 6.3.1
  8. StatusCreated = 201 // RFC 7231, 6.3.2
  9. StatusAccepted = 202 // RFC 7231, 6.3.3
  10. StatusNonAuthoritativeInfo = 203 // RFC 7231, 6.3.4
  11. StatusNoContent = 204 // RFC 7231, 6.3.5
  12. StatusResetContent = 205 // RFC 7231, 6.3.6
  13. StatusPartialContent = 206 // RFC 7233, 4.1
  14. StatusMultiStatus = 207 // RFC 4918, 11.1
  15. StatusAlreadyReported = 208 // RFC 5842, 7.1
  16. StatusIMUsed = 226 // RFC 3229, 10.4.1
  17. StatusMultipleChoices = 300 // RFC 7231, 6.4.1
  18. StatusMovedPermanently = 301 // RFC 7231, 6.4.2
  19. StatusFound = 302 // RFC 7231, 6.4.3
  20. StatusSeeOther = 303 // RFC 7231, 6.4.4
  21. StatusNotModified = 304 // RFC 7232, 4.1
  22. StatusUseProxy = 305 // RFC 7231, 6.4.5
  23. _ = 306 // RFC 7231, 6.4.6 (Unused)
  24. StatusTemporaryRedirect = 307 // RFC 7231, 6.4.7
  25. StatusPermanentRedirect = 308 // RFC 7538, 3
  26. StatusBadRequest = 400 // RFC 7231, 6.5.1
  27. StatusUnauthorized = 401 // RFC 7235, 3.1
  28. StatusPaymentRequired = 402 // RFC 7231, 6.5.2
  29. StatusForbidden = 403 // RFC 7231, 6.5.3
  30. StatusNotFound = 404 // RFC 7231, 6.5.4
  31. StatusMethodNotAllowed = 405 // RFC 7231, 6.5.5
  32. StatusNotAcceptable = 406 // RFC 7231, 6.5.6
  33. StatusProxyAuthRequired = 407 // RFC 7235, 3.2
  34. StatusRequestTimeout = 408 // RFC 7231, 6.5.7
  35. StatusConflict = 409 // RFC 7231, 6.5.8
  36. StatusGone = 410 // RFC 7231, 6.5.9
  37. StatusLengthRequired = 411 // RFC 7231, 6.5.10
  38. StatusPreconditionFailed = 412 // RFC 7232, 4.2
  39. StatusRequestEntityTooLarge = 413 // RFC 7231, 6.5.11
  40. StatusRequestURITooLong = 414 // RFC 7231, 6.5.12
  41. StatusUnsupportedMediaType = 415 // RFC 7231, 6.5.13
  42. StatusRequestedRangeNotSatisfiable = 416 // RFC 7233, 4.4
  43. StatusExpectationFailed = 417 // RFC 7231, 6.5.14
  44. StatusTeapot = 418 // RFC 7168, 2.3.3
  45. StatusUnprocessableEntity = 422 // RFC 4918, 11.2
  46. StatusLocked = 423 // RFC 4918, 11.3
  47. StatusFailedDependency = 424 // RFC 4918, 11.4
  48. StatusUpgradeRequired = 426 // RFC 7231, 6.5.15
  49. StatusPreconditionRequired = 428 // RFC 6585, 3
  50. StatusTooManyRequests = 429 // RFC 6585, 4
  51. StatusRequestHeaderFieldsTooLarge = 431 // RFC 6585, 5
  52. StatusUnavailableForLegalReasons = 451 // RFC 7725, 3
  53. StatusInternalServerError = 500 // RFC 7231, 6.6.1
  54. StatusNotImplemented = 501 // RFC 7231, 6.6.2
  55. StatusBadGateway = 502 // RFC 7231, 6.6.3
  56. StatusServiceUnavailable = 503 // RFC 7231, 6.6.4
  57. StatusGatewayTimeout = 504 // RFC 7231, 6.6.5
  58. StatusLINKERVersionNotSupported = 505 // RFC 7231, 6.6.6
  59. StatusVariantAlsoNegotiates = 506 // RFC 2295, 8.1
  60. StatusInsufficientStorage = 507 // RFC 4918, 11.5
  61. StatusLoopDetected = 508 // RFC 5842, 7.2
  62. StatusNotExtended = 510 // RFC 2774, 7
  63. StatusNetworkAuthenticationRequired = 511 // RFC 6585, 6
  64. )
  65. var statusText = map[int]string{
  66. StatusContinue: "Continue",
  67. StatusSwitchingProtocols: "Switching Protocols",
  68. StatusProcessing: "Processing",
  69. StatusOK: "OK",
  70. StatusCreated: "Created",
  71. StatusAccepted: "Accepted",
  72. StatusNonAuthoritativeInfo: "Non-Authoritative Information",
  73. StatusNoContent: "No Content",
  74. StatusResetContent: "Reset Content",
  75. StatusPartialContent: "Partial Content",
  76. StatusMultiStatus: "Multi-Status",
  77. StatusAlreadyReported: "Already Reported",
  78. StatusIMUsed: "IM Used",
  79. StatusMultipleChoices: "Multiple Choices",
  80. StatusMovedPermanently: "Moved Permanently",
  81. StatusFound: "Found",
  82. StatusSeeOther: "See Other",
  83. StatusNotModified: "Not Modified",
  84. StatusUseProxy: "Use Proxy",
  85. StatusTemporaryRedirect: "Temporary Redirect",
  86. StatusPermanentRedirect: "Permanent Redirect",
  87. StatusBadRequest: "Bad Request",
  88. StatusUnauthorized: "Unauthorized",
  89. StatusPaymentRequired: "Payment Required",
  90. StatusForbidden: "Forbidden",
  91. StatusNotFound: "Not Found",
  92. StatusMethodNotAllowed: "Method Not Allowed",
  93. StatusNotAcceptable: "Not Acceptable",
  94. StatusProxyAuthRequired: "Proxy Authentication Required",
  95. StatusRequestTimeout: "Request Timeout",
  96. StatusConflict: "Conflict",
  97. StatusGone: "Gone",
  98. StatusLengthRequired: "Length Required",
  99. StatusPreconditionFailed: "Precondition Failed",
  100. StatusRequestEntityTooLarge: "Request Entity Too Large",
  101. StatusRequestURITooLong: "Request URI Too Long",
  102. StatusUnsupportedMediaType: "Unsupported Media Type",
  103. StatusRequestedRangeNotSatisfiable: "Requested Range Not Satisfiable",
  104. StatusExpectationFailed: "Expectation Failed",
  105. StatusTeapot: "I'm a teapot",
  106. StatusUnprocessableEntity: "Unprocessable Entity",
  107. StatusLocked: "Locked",
  108. StatusFailedDependency: "Failed Dependency",
  109. StatusUpgradeRequired: "Upgrade Required",
  110. StatusPreconditionRequired: "Precondition Required",
  111. StatusTooManyRequests: "Too Many Requests",
  112. StatusRequestHeaderFieldsTooLarge: "Request Header Fields Too Large",
  113. StatusUnavailableForLegalReasons: "Unavailable For Legal Reasons",
  114. StatusInternalServerError: "Internal Server Error",
  115. StatusNotImplemented: "Not Implemented",
  116. StatusBadGateway: "Bad Gateway",
  117. StatusServiceUnavailable: "Service Unavailable",
  118. StatusGatewayTimeout: "Gateway Timeout",
  119. StatusLINKERVersionNotSupported: "HTTP Version Not Supported",
  120. StatusVariantAlsoNegotiates: "Variant Also Negotiates",
  121. StatusInsufficientStorage: "Insufficient Storage",
  122. StatusLoopDetected: "Loop Detected",
  123. StatusNotExtended: "Not Extended",
  124. StatusNetworkAuthenticationRequired: "Network Authentication Required",
  125. }
  126. // StatusText returns a text for the linker status code. It returns the empty
  127. // string if the code is unknown.
  128. func StatusText(code int) string {
  129. return statusText[code]
  130. }