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