///|
/// Common HTTP reason phrases. Unknown valid status codes return None.
pub fn status_reason(code : Int) -> String? {
match code {
400 => Some("Bad Request")
401 => Some("Unauthorized")
403 => Some("Forbidden")
404 => Some("Not Found")
405 => Some("Method Not Allowed")
409 => Some("Conflict")
410 => Some("Gone")
415 => Some("Unsupported Media Type")
422 => Some("Unprocessable Content")
429 => Some("Too Many Requests")
500 => Some("Internal Server Error")
501 => Some("Not Implemented")
502 => Some("Bad Gateway")
503 => Some("Service Unavailable")
504 => Some("Gateway Timeout")
_ => None
}
}
///|
pub fn is_valid_http_status(code : Int) -> Bool {
code >= 100 && code <= 599
}