1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
pub fn get_status_text(code: u16) -> Option<String> {
match code {
100 => Some(String::from("Continue")),
101 => Some(String::from("Switching Protocols")),
102 => Some(String::from("Processing")),
200 => Some(String::from("OK")),
201 => Some(String::from("Created")),
202 => Some(String::from("Accepted")),
203 => Some(String::from("Non Authoritative Information")),
204 => Some(String::from("No Content")),
205 => Some(String::from("Reset Content")),
206 => Some(String::from("Partial Content")),
207 => Some(String::from("Multi Status")),
226 => Some(String::from("IM Used")),
300 => Some(String::from("Multiple Choices")),
301 => Some(String::from("Moved Permanently")),
302 => Some(String::from("Found")),
303 => Some(String::from("See Other")),
304 => Some(String::from("Not Modified")),
305 => Some(String::from("Use Proxy")),
307 => Some(String::from("Temporary Redirect")),
308 => Some(String::from("Permanent Redirect")),
400 => Some(String::from("Bad Request")),
401 => Some(String::from("Unauthorized")),
402 => Some(String::from("Payment Required")),
403 => Some(String::from("Forbidden")),
404 => Some(String::from("Not Found")),
405 => Some(String::from("Method Not Allowed")),
406 => Some(String::from("Not Acceptable")),
407 => Some(String::from("Proxy Authentication Required")),
408 => Some(String::from("Request Timeout")),
409 => Some(String::from("Conflict")),
410 => Some(String::from("Gone")),
411 => Some(String::from("Length Required")),
412 => Some(String::from("Precondition Failed")),
413 => Some(String::from("Request Entity Too Large")),
414 => Some(String::from("Request URI Too Long")),
415 => Some(String::from("Unsupported Media Type")),
416 => Some(String::from("Requested Range Not Satisfiable")),
417 => Some(String::from("Expectation Failed")),
418 => Some(String::from("I'm a teapot")),
421 => Some(String::from("Misdirected Request")),
422 => Some(String::from("Unprocessable Entity")),
423 => Some(String::from("Locked")),
424 => Some(String::from("Failed Dependency")),
426 => Some(String::from("Upgrade Required")),
428 => Some(String::from("Precondition Required")),
429 => Some(String::from("Too Many Requests")),
431 => Some(String::from("Request Header Fields Too Large")),
449 => Some(String::from("Retry With")),
451 => Some(String::from("Unavailable For Legal Reasons")),
500 => Some(String::from("Internal Server Error")),
501 => Some(String::from("Not Implemented")),
502 => Some(String::from("Bad Gateway")),
503 => Some(String::from("Service Unavailable")),
504 => Some(String::from("Gateway Timeout")),
505 => Some(String::from("HTTP Version Not Supported")),
_ => None
}
}
|