github.com/duomi520/utils@v0.0.0-20240430123446-e03a4cddd6ec/status.go (about)

     1  package utils
     2  
     3  //状态码
     4  const (
     5  	StatusUnknown = iota + 10
     6  	StatusNil
     7  	StatusPing
     8  	StatusPong
     9  	StatusGoaway
    10  	StatusRequest
    11  	StatusResponse
    12  	StatusCtxCancelFunc
    13  	StatusSubscribe
    14  	StatusUnsubscribe
    15  	StatusStream
    16  	StatusBroadcast
    17  	StatusError
    18  )
    19  
    20  //状态码
    21  const (
    22  	StatusUnknown16 uint16 = iota + 10
    23  	StatusNil16
    24  	StatusPing16
    25  	StatusPong16
    26  	StatusGoaway16
    27  	StatusRequest16
    28  	StatusResponse16
    29  	StatusCtxCancelFunc16
    30  	StatusSubscribe16
    31  	StatusUnsubscribe16
    32  	StatusStream16
    33  	StatusBroadcast16
    34  	StatusError16
    35  )
    36  
    37  // HTTP状态码,参见RFC 2616
    38  const (
    39  	StatusContinue           = 100 // RFC 7231, 6.2.1
    40  	StatusSwitchingProtocols = 101 // RFC 7231, 6.2.2
    41  	StatusProcessing         = 102 // RFC 2518, 10.1
    42  	StatusEarlyHints         = 103 // RFC 8297
    43  
    44  	StatusOK                   = 200 // RFC 7231, 6.3.1
    45  	StatusCreated              = 201 // RFC 7231, 6.3.2
    46  	StatusAccepted             = 202 // RFC 7231, 6.3.3
    47  	StatusNonAuthoritativeInfo = 203 // RFC 7231, 6.3.4
    48  	StatusNoContent            = 204 // RFC 7231, 6.3.5
    49  	StatusResetContent         = 205 // RFC 7231, 6.3.6
    50  	StatusMultiStatus          = 207 // RFC 4918, 11.1
    51  	StatusAlreadyReported      = 208 // RFC 5842, 7.1
    52  	StatusIMUsed               = 226 // RFC 3229, 10.4.1
    53  
    54  	StatusMultipleChoices   = 300 // RFC 7231, 6.4.1
    55  	StatusMovedPermanently  = 301 // RFC 7231, 6.4.2
    56  	StatusFound             = 302 // RFC 7231, 6.4.3
    57  	StatusSeeOther          = 303 // RFC 7231, 6.4.4
    58  	StatusNotModified       = 304 // RFC 7232, 4.1
    59  	StatusUseProxy          = 305 // RFC 7231, 6.4.5
    60  	StatusTemporaryRedirect = 307 // RFC 7231, 6.4.7
    61  	StatusPermanentRedirect = 308 // RFC 7538, 3
    62  
    63  	StatusBadRequest                   = 400 // RFC 7231, 6.5.1
    64  	StatusUnauthorized                 = 401 // RFC 7235, 3.1
    65  	StatusPaymentRequired              = 402 // RFC 7231, 6.5.2
    66  	StatusForbidden                    = 403 // RFC 7231, 6.5.3
    67  	StatusNotFound                     = 404 // RFC 7231, 6.5.4
    68  	StatusMethodNotAllowed             = 405 // RFC 7231, 6.5.5
    69  	StatusNotAcceptable                = 406 // RFC 7231, 6.5.6
    70  	StatusProxyAuthRequired            = 407 // RFC 7235, 3.2
    71  	StatusRequestTimeout               = 408 // RFC 7231, 6.5.7
    72  	StatusConflict                     = 409 // RFC 7231, 6.5.8
    73  	StatusGone                         = 410 // RFC 7231, 6.5.9
    74  	StatusLengthRequired               = 411 // RFC 7231, 6.5.10
    75  	StatusPreconditionFailed           = 412 // RFC 7232, 4.2
    76  	StatusRequestEntityTooLarge        = 413 // RFC 7231, 6.5.11
    77  	StatusRequestURITooLong            = 414 // RFC 7231, 6.5.12
    78  	StatusUnsupportedMediaType         = 415 // RFC 7231, 6.5.13
    79  	StatusRequestedRangeNotSatisfiable = 416 // RFC 7233, 4.4
    80  	StatusExpectationFailed            = 417 // RFC 7231, 6.5.14
    81  	StatusTeapot                       = 418 // RFC 7168, 2.3.3
    82  	StatusMisdirectedRequest           = 421 // RFC 7540, 9.1.2
    83  	StatusUnprocessableEntity          = 422 // RFC 4918, 11.2
    84  	StatusLocked                       = 423 // RFC 4918, 11.3
    85  	StatusFailedDependency             = 424 // RFC 4918, 11.4
    86  	StatusUpgradeRequired              = 426 // RFC 7231, 6.5.15
    87  	StatusPreconditionRequired         = 428 // RFC 6585, 3
    88  	StatusTooManyRequests              = 429 // RFC 6585, 4
    89  	StatusRequestHeaderFieldsTooLarge  = 431 // RFC 6585, 5
    90  	StatusUnavailableForLegalReasons   = 451 // RFC 7725, 3
    91  
    92  	StatusInternalServerError           = 500 // RFC 7231, 6.6.1
    93  	StatusNotImplemented                = 501 // RFC 7231, 6.6.2
    94  	StatusBadGateway                    = 502 // RFC 7231, 6.6.3
    95  	StatusServiceUnavailable            = 503 // RFC 7231, 6.6.4
    96  	StatusGatewayTimeout                = 504 // RFC 7231, 6.6.5
    97  	StatusHTTPVersionNotSupported       = 505 // RFC 7231, 6.6.6
    98  	StatusVariantAlsoNegotiates         = 506 // RFC 2295, 8.1
    99  	StatusInsufficientStorage           = 507 // RFC 4918, 11.5
   100  	StatusLoopDetected                  = 508 // RFC 5842, 7.2
   101  	StatusNotExtended                   = 510 // RFC 2774, 7
   102  	StatusNetworkAuthenticationRequired = 511 // RFC 6585, 6
   103  )
   104  const (
   105  	StatusContinue16           uint16 = 100
   106  	StatusSwitchingProtocols16 uint16 = 101
   107  	StatusProcessing16         uint16 = 102
   108  	StatusEarlyHints16         uint16 = 103
   109  
   110  	StatusOK16                   uint16 = 200
   111  	StatusCreated16              uint16 = 201
   112  	StatusAccepted16             uint16 = 202
   113  	StatusNonAuthoritativeInfo16 uint16 = 203
   114  	StatusNoContent16            uint16 = 204
   115  	StatusResetContent16         uint16 = 205
   116  	StatusPartialContent16       uint16 = 206
   117  	StatusMultiStatus16          uint16 = 207
   118  	StatusAlreadyReported16      uint16 = 208
   119  	StatusIMUsed16               uint16 = 226
   120  
   121  	StatusMultipleChoices16   uint16 = 300
   122  	StatusMovedPermanently16  uint16 = 301
   123  	StatusFound16             uint16 = 302
   124  	StatusSeeOther16          uint16 = 303
   125  	StatusNotModified16       uint16 = 304
   126  	StatusUseProxy16          uint16 = 305
   127  	StatusTemporaryRedirect16 uint16 = 307
   128  	StatusPermanentRedirect16 uint16 = 308
   129  
   130  	StatusBadRequest16                   uint16 = 400
   131  	StatusUnauthorized16                 uint16 = 401
   132  	StatusPaymentRequired16              uint16 = 402
   133  	StatusForbidden16                    uint16 = 403
   134  	StatusNotFound16                     uint16 = 404
   135  	StatusMethodNotAllowed16             uint16 = 405
   136  	StatusNotAcceptable16                uint16 = 406
   137  	StatusProxyAuthRequired16            uint16 = 407
   138  	StatusRequestTimeout16               uint16 = 408
   139  	StatusConflict16                     uint16 = 409
   140  	StatusGone16                         uint16 = 410
   141  	StatusLengthRequired16               uint16 = 411
   142  	StatusPreconditionFailed16           uint16 = 412
   143  	StatusRequestEntityTooLarge16        uint16 = 413
   144  	StatusRequestURITooLong16            uint16 = 414
   145  	StatusUnsupportedMediaType16         uint16 = 415
   146  	StatusRequestedRangeNotSatisfiable16 uint16 = 416
   147  	StatusExpectationFailed16            uint16 = 417
   148  	StatusTeapot16                       uint16 = 418
   149  	StatusMisdirectedRequest16           uint16 = 421
   150  	StatusUnprocessableEntity16          uint16 = 422
   151  	StatusLocked16                       uint16 = 423
   152  	StatusFailedDependency16             uint16 = 424
   153  	StatusUpgradeRequired16              uint16 = 426
   154  	StatusPreconditionRequired16         uint16 = 428
   155  	StatusTooManyRequests16              uint16 = 429
   156  	StatusRequestHeaderFieldsTooLarge16  uint16 = 431
   157  	StatusUnavailableForLegalReasons16   uint16 = 451
   158  
   159  	StatusInternalServerError16           uint16 = 500
   160  	StatusNotImplemented16                uint16 = 501
   161  	StatusBadGateway16                    uint16 = 502
   162  	StatusServiceUnavailable16            uint16 = 503
   163  	StatusGatewayTimeout16                uint16 = 504
   164  	StatusHTTPVersionNotSupported16       uint16 = 505
   165  	StatusVariantAlsoNegotiates16         uint16 = 506
   166  	StatusInsufficientStorage16           uint16 = 507
   167  	StatusLoopDetected16                  uint16 = 508
   168  	StatusNotExtended16                   uint16 = 510
   169  	StatusNetworkAuthenticationRequired16 uint16 = 511
   170  )