-
-
Save jboulhous/4952770 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
HTTP status code messages | |
*/ | |
function getStatusCodeMsg (code) { | |
var msg = false; | |
switch (code) { | |
case 100: | |
msg = "Continue"; | |
break; | |
case 101: | |
msg = "Switching Protocols"; | |
break; | |
case 102: | |
msg = "Processing"; | |
break; | |
case 200: | |
msg = "OK"; | |
break; | |
case 201: | |
msg = "Created"; | |
break; | |
case 202: | |
msg = "Accepted"; | |
break; | |
case 203: | |
msg = "Non-Authoritative Information"; | |
break; | |
case 204: | |
msg = "No Content"; | |
break; | |
case 205: | |
msg = "Reset Content"; | |
break; | |
case 206: | |
msg = "Partial Content"; | |
break; | |
case 207 : | |
msg = "Multi-Status"; | |
break; | |
case 208: | |
msg = "Already Reported"; | |
break; | |
case 226 : | |
msg = "IM Used"; | |
break; | |
case 300: | |
msg = "Multiple Choices"; | |
break; | |
case 301 : | |
msg = "Moved Permanently"; | |
break; | |
case 302: | |
msg = "Found"; | |
break; | |
case 303: | |
msg = "See Other"; | |
break; | |
case 304: | |
msg = "Not Modified"; | |
break; | |
case 305: | |
msg = "Use Proxy"; | |
break; | |
case 306 : | |
msg = "Reserved"; | |
break; | |
case 307: | |
msg = "Temporary Redirect"; | |
break; | |
case 308 : | |
msg = "Permanent Redirect"; | |
break; | |
case 400: | |
msg = "Bad Request"; | |
break; | |
case 401: | |
msg = "Unauthorized"; | |
break; | |
case 402 : | |
msg = "Payment Required"; | |
break; | |
case 403: | |
msg = "Forbidden"; | |
break; | |
case 404 : | |
msg = "Not Found"; | |
break; | |
case 405: | |
msg = "Method Not Allowed"; | |
break; | |
case 406: | |
msg = "Not Acceptable"; | |
break; | |
case 407: | |
msg = "Proxy Authentication Required"; | |
break; | |
case 408: | |
msg = "Request Timeout"; | |
break; | |
case 409: | |
msg = "Conflict"; | |
break; | |
case 410: | |
msg = "Gone"; | |
break; | |
case 411: | |
msg = "Length Required"; | |
break; | |
case 412: | |
msg = "Precondition Failed"; | |
break; | |
case 413: | |
msg = "Request Entity Too Large"; | |
break; | |
case 414: | |
msg = "Request-URI Too Long"; | |
break; | |
case 415: | |
msg = "Unsupported Media Type"; | |
break; | |
case 416: | |
msg = "Requested Range Not Satisfiable"; | |
break; | |
case 417: | |
msg = "Expectation Failed"; | |
break; | |
case 422: | |
msg = "Unprocessable Entity"; | |
break; | |
case 423: | |
msg = "Locked"; | |
break; | |
case 424: | |
msg = "Failed Dependency"; | |
break; | |
case 425: | |
msg = "Reserved for WebDAV advanced collections expired proposal"; | |
break; | |
case 426: | |
msg = "Upgrade Required"; | |
break; | |
case 427: | |
msg = "Unassigned"; | |
break; | |
case 428: | |
msg = "Precondition Required"; | |
break; | |
case 429: | |
msg = "Too Many Requests"; | |
break; | |
case 430: | |
msg = "Unassigned"; | |
break; | |
case 431: | |
msg = "Request Header Fields Too Large"; | |
break; | |
case 500: | |
msg = "Internal Server Error"; | |
break; | |
case 501: | |
msg = "Not Implemented"; | |
break; | |
case 502: | |
msg = "Bad Gateway"; | |
break; | |
case 503: | |
msg = "Service Unavailable"; | |
break; | |
case 504: | |
msg = "Gateway Timeout"; | |
break; | |
case 505: | |
msg = "HTTP Version Not Supported"; | |
break; | |
case 506: | |
msg = "Variant Also Negotiates (Experimental)"; | |
break; | |
case 507: | |
msg = "Insufficient Storage"; | |
break; | |
case 508: | |
msg = "Loop Detected"; | |
break; | |
case 509: | |
msg = "Unassigned"; | |
break; | |
case 510: | |
msg = "Not Extended"; | |
break; | |
case 511: | |
msg = "Network Authentication Required"; | |
break; | |
} | |
return msg; | |
} | |
// module.exports = getStatusCodeMsg; // uncomment to use as module in Node |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment