Source file
src/net/http/status.go
1
2
3
4
5 package http
6
7
8
9 const (
10 StatusContinue = 100
11 StatusSwitchingProtocols = 101
12 StatusProcessing = 102
13 StatusEarlyHints = 103
14
15 StatusOK = 200
16 StatusCreated = 201
17 StatusAccepted = 202
18 StatusNonAuthoritativeInfo = 203
19 StatusNoContent = 204
20 StatusResetContent = 205
21 StatusPartialContent = 206
22 StatusMultiStatus = 207
23 StatusAlreadyReported = 208
24 StatusIMUsed = 226
25
26 StatusMultipleChoices = 300
27 StatusMovedPermanently = 301
28 StatusFound = 302
29 StatusSeeOther = 303
30 StatusNotModified = 304
31 StatusUseProxy = 305
32 _ = 306
33 StatusTemporaryRedirect = 307
34 StatusPermanentRedirect = 308
35
36 StatusBadRequest = 400
37 StatusUnauthorized = 401
38 StatusPaymentRequired = 402
39 StatusForbidden = 403
40 StatusNotFound = 404
41 StatusMethodNotAllowed = 405
42 StatusNotAcceptable = 406
43 StatusProxyAuthRequired = 407
44 StatusRequestTimeout = 408
45 StatusConflict = 409
46 StatusGone = 410
47 StatusLengthRequired = 411
48 StatusPreconditionFailed = 412
49 StatusRequestEntityTooLarge = 413
50 StatusRequestURITooLong = 414
51 StatusUnsupportedMediaType = 415
52 StatusRequestedRangeNotSatisfiable = 416
53 StatusExpectationFailed = 417
54 StatusTeapot = 418
55 StatusMisdirectedRequest = 421
56 StatusUnprocessableEntity = 422
57 StatusLocked = 423
58 StatusFailedDependency = 424
59 StatusTooEarly = 425
60 StatusUpgradeRequired = 426
61 StatusPreconditionRequired = 428
62 StatusTooManyRequests = 429
63 StatusRequestHeaderFieldsTooLarge = 431
64 StatusUnavailableForLegalReasons = 451
65
66 StatusInternalServerError = 500
67 StatusNotImplemented = 501
68 StatusBadGateway = 502
69 StatusServiceUnavailable = 503
70 StatusGatewayTimeout = 504
71 StatusHTTPVersionNotSupported = 505
72 StatusVariantAlsoNegotiates = 506
73 StatusInsufficientStorage = 507
74 StatusLoopDetected = 508
75 StatusNotExtended = 510
76 StatusNetworkAuthenticationRequired = 511
77 )
78
79
80
81 func StatusText(code int) string {
82 switch code {
83 case StatusContinue:
84 return "Continue"
85 case StatusSwitchingProtocols:
86 return "Switching Protocols"
87 case StatusProcessing:
88 return "Processing"
89 case StatusEarlyHints:
90 return "Early Hints"
91 case StatusOK:
92 return "OK"
93 case StatusCreated:
94 return "Created"
95 case StatusAccepted:
96 return "Accepted"
97 case StatusNonAuthoritativeInfo:
98 return "Non-Authoritative Information"
99 case StatusNoContent:
100 return "No Content"
101 case StatusResetContent:
102 return "Reset Content"
103 case StatusPartialContent:
104 return "Partial Content"
105 case StatusMultiStatus:
106 return "Multi-Status"
107 case StatusAlreadyReported:
108 return "Already Reported"
109 case StatusIMUsed:
110 return "IM Used"
111 case StatusMultipleChoices:
112 return "Multiple Choices"
113 case StatusMovedPermanently:
114 return "Moved Permanently"
115 case StatusFound:
116 return "Found"
117 case StatusSeeOther:
118 return "See Other"
119 case StatusNotModified:
120 return "Not Modified"
121 case StatusUseProxy:
122 return "Use Proxy"
123 case StatusTemporaryRedirect:
124 return "Temporary Redirect"
125 case StatusPermanentRedirect:
126 return "Permanent Redirect"
127 case StatusBadRequest:
128 return "Bad Request"
129 case StatusUnauthorized:
130 return "Unauthorized"
131 case StatusPaymentRequired:
132 return "Payment Required"
133 case StatusForbidden:
134 return "Forbidden"
135 case StatusNotFound:
136 return "Not Found"
137 case StatusMethodNotAllowed:
138 return "Method Not Allowed"
139 case StatusNotAcceptable:
140 return "Not Acceptable"
141 case StatusProxyAuthRequired:
142 return "Proxy Authentication Required"
143 case StatusRequestTimeout:
144 return "Request Timeout"
145 case StatusConflict:
146 return "Conflict"
147 case StatusGone:
148 return "Gone"
149 case StatusLengthRequired:
150 return "Length Required"
151 case StatusPreconditionFailed:
152 return "Precondition Failed"
153 case StatusRequestEntityTooLarge:
154 return "Request Entity Too Large"
155 case StatusRequestURITooLong:
156 return "Request URI Too Long"
157 case StatusUnsupportedMediaType:
158 return "Unsupported Media Type"
159 case StatusRequestedRangeNotSatisfiable:
160 return "Requested Range Not Satisfiable"
161 case StatusExpectationFailed:
162 return "Expectation Failed"
163 case StatusTeapot:
164 return "I'm a teapot"
165 case StatusMisdirectedRequest:
166 return "Misdirected Request"
167 case StatusUnprocessableEntity:
168 return "Unprocessable Entity"
169 case StatusLocked:
170 return "Locked"
171 case StatusFailedDependency:
172 return "Failed Dependency"
173 case StatusTooEarly:
174 return "Too Early"
175 case StatusUpgradeRequired:
176 return "Upgrade Required"
177 case StatusPreconditionRequired:
178 return "Precondition Required"
179 case StatusTooManyRequests:
180 return "Too Many Requests"
181 case StatusRequestHeaderFieldsTooLarge:
182 return "Request Header Fields Too Large"
183 case StatusUnavailableForLegalReasons:
184 return "Unavailable For Legal Reasons"
185 case StatusInternalServerError:
186 return "Internal Server Error"
187 case StatusNotImplemented:
188 return "Not Implemented"
189 case StatusBadGateway:
190 return "Bad Gateway"
191 case StatusServiceUnavailable:
192 return "Service Unavailable"
193 case StatusGatewayTimeout:
194 return "Gateway Timeout"
195 case StatusHTTPVersionNotSupported:
196 return "HTTP Version Not Supported"
197 case StatusVariantAlsoNegotiates:
198 return "Variant Also Negotiates"
199 case StatusInsufficientStorage:
200 return "Insufficient Storage"
201 case StatusLoopDetected:
202 return "Loop Detected"
203 case StatusNotExtended:
204 return "Not Extended"
205 case StatusNetworkAuthenticationRequired:
206 return "Network Authentication Required"
207 default:
208 return ""
209 }
210 }
211
View as plain text