一般的な Web Programmer ならば、HTTP Status code はすべて暗記していると聞きました。
しかし、僕は初心者なので、なかなか覚えきれていないので、HTTPのステータスコードをさがすのに便利なツールを用意しました。
HttpStatus.fs です。インストール方法は 適当にコンパイルしてください。
| type HttpStatus = | |
| { Code: string; Message: string } | |
| override self.ToString () = sprintf "%s %s" self.Code self.Message | |
| let httpStatus code message = { Code = code; Message = message } | |
| let httpStatusList =[ | |
| httpStatus "100" "Continue"; | |
| httpStatus "101" "Switching Protocols"; | |
| httpStatus "102" "Processing"; | |
| httpStatus "200" "OK"; | |
| httpStatus "201" "Created"; | |
| httpStatus "202" "Accepted"; | |
| httpStatus "203" "Non-Authoritative Information"; | |
| httpStatus "204" "No Content"; | |
| httpStatus "205" "Reset Content"; | |
| httpStatus "206" "Partial Content"; | |
| httpStatus "207" "Multi-Status"; | |
| httpStatus "208" "Already Reported"; | |
| httpStatus "300" "Multiple Choices"; | |
| httpStatus "301" "Moved Permanently"; | |
| httpStatus "302" "Found"; | |
| httpStatus "303" "See Other"; | |
| httpStatus "304" "Not Modified"; | |
| httpStatus "305" "Use Proxy"; | |
| httpStatus "307" "Temporary Redirect"; | |
| httpStatus "400" "Bad Request"; | |
| httpStatus "401" "Unauthorized"; | |
| httpStatus "402" "Payment Required"; | |
| httpStatus "403" "Forbidden"; | |
| httpStatus "404" "Not Found"; | |
| httpStatus "405" "Method Not Allowed"; | |
| httpStatus "406" "Not Acceptable"; | |
| httpStatus "407" "Proxy Authentication Required"; | |
| httpStatus "408" "Request Timeout"; | |
| httpStatus "409" "Conflict"; | |
| httpStatus "410" "Gone"; | |
| httpStatus "411" "Length Required"; | |
| httpStatus "412" "Precondition Failed"; | |
| httpStatus "413" "Request Entity Too Large"; | |
| httpStatus "414" "Request-URI Too Large"; | |
| httpStatus "415" "Unsupported Media Type"; | |
| httpStatus "416" "Request Range Not Satisfiable"; | |
| httpStatus "417" "Expectation Failed"; | |
| httpStatus "418" "I'm a teapot"; | |
| httpStatus "422" "Unprocessable Entity"; | |
| httpStatus "423" "Locked"; | |
| httpStatus "424" "Failed Dependency"; | |
| httpStatus "425" "No code"; | |
| httpStatus "426" "Upgrade Required"; | |
| httpStatus "428" "Precondition Required"; | |
| httpStatus "429" "Too Many Requests"; | |
| httpStatus "431" "Request Header Fields Too Large"; | |
| httpStatus "449" "Retry with"; | |
| httpStatus "500" "Internal Server Error"; | |
| httpStatus "501" "Not Implemented"; | |
| httpStatus "502" "Bad Gateway"; | |
| httpStatus "503" "Service Unavailable"; | |
| httpStatus "504" "Gateway Timeout"; | |
| httpStatus "505" "HTTP Version Not Supported"; | |
| httpStatus "506" "Variant Also Negotiates"; | |
| httpStatus "507" "Insufficient Storage"; | |
| httpStatus "509" "Bandwidth Limit Exceeded"; | |
| httpStatus "510" "Not Extended"; | |
| httpStatus "511" "Network Authentication Required" | |
| ] | |
| let showStatus key = | |
| match List.tryFind (fun hs -> hs.Code = key) httpStatusList with | |
| | Some hs -> hs.ToString() |> printfn "%s" | |
| | _ -> | |
| let toStringAll xs = List.map (fun x -> x.ToString()) xs | |
| match List.filter (fun hs -> hs.Code.Contains key) httpStatusList with | |
| | [] -> | |
| match List.filter (fun hs -> hs.Message.Contains key) httpStatusList with | |
| | [] -> toStringAll httpStatusList | |
| | hss -> toStringAll hss | |
| | hss -> toStringAll hss | |
| |> List.iter (printfn "%s") | |
| [<EntryPoint>] | |
| let main args = | |
| if args.Length <> 1 then showStatus "" | |
| else showStatus args.[0] | |
| 0 |
一般的な Web Programmer ならば、HTTP Status code はすべて暗記していると聞きました。
しかし、僕は初心者なので、なかなか覚えきれていないので、HTTPのステータスコードをさがすのに便利なツールを用意しました。
HttpStatus.fs です。インストール方法は 適当にコンパイルしてください。