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