/http-status-codes/index.js

From disqus.com, 1 Year ago, written in JavaScript, viewed 3 times. This paste is a reply to moderationRules.js from disqus.com - view diff
URL https://pastebin.freepbx.org/view/cc3da3ff Embed
Download Paste or View Raw
  1. /**
  2.  * Constants enumerating the HTTP status codes.
  3.  *
  4.  * All status codes defined in RFC1945 (HTTP/1.0, RFC2616 (HTTP/1.1),
  5.  * and RFC2518 (WebDAV) are supported.
  6.  *
  7.  * Based on the org.apache.commons.httpclient.HttpStatus Java API.
  8.  *
  9.  * Ported by Bryce Neal.
  10.  */
  11.  
  12. var statusCodes = {};
  13.  
  14. statusCodes[exports.ACCEPTED = 202] = "Accepted";
  15. statusCodes[exports.BAD_GATEWAY = 502] = "Bad Gateway";
  16. statusCodes[exports.BAD_REQUEST = 400] = "Bad Request";
  17. statusCodes[exports.CONFLICT = 409] = "Conflict";
  18. statusCodes[exports.CONTINUE = 100] = "Continue";
  19. statusCodes[exports.CREATED = 201] = "Created";
  20. statusCodes[exports.EXPECTATION_FAILED = 417] = "Expectation Failed";
  21. statusCodes[exports.FAILED_DEPENDENCY  = 424] = "Failed Dependency";
  22. statusCodes[exports.FORBIDDEN = 403] = "Forbidden";
  23. statusCodes[exports.GATEWAY_TIMEOUT = 504] = "Gateway Timeout";
  24. statusCodes[exports.GONE = 410] = "Gone";
  25. statusCodes[exports.HTTP_VERSION_NOT_SUPPORTED = 505] = "HTTP Version Not Supported";
  26. statusCodes[exports.INSUFFICIENT_SPACE_ON_RESOURCE = 419] = "Insufficient Space on Resource";
  27. statusCodes[exports.INSUFFICIENT_STORAGE = 507] = "Insufficient Storage";
  28. statusCodes[exports.INTERNAL_SERVER_ERROR = 500] = "Server Error";
  29. statusCodes[exports.LENGTH_REQUIRED = 411] = "Length Required";
  30. statusCodes[exports.LOCKED = 423] = "Locked";
  31. statusCodes[exports.METHOD_FAILURE = 420] = "Method Failure";
  32. statusCodes[exports.METHOD_NOT_ALLOWED = 405] = "Method Not Allowed";
  33. statusCodes[exports.MOVED_PERMANENTLY = 301] = "Moved Permanently";
  34. statusCodes[exports.MOVED_TEMPORARILY = 302] = "Moved Temporarily";
  35. statusCodes[exports.MULTI_STATUS = 207] = "Multi-Status";
  36. statusCodes[exports.MULTIPLE_CHOICES = 300] = "Multiple Choices";
  37. statusCodes[exports.NETWORK_AUTHENTICATION_REQUIRED = 511] = "Network Authentication Required";
  38. statusCodes[exports.NO_CONTENT = 204] = "No Content";
  39. statusCodes[exports.NON_AUTHORITATIVE_INFORMATION = 203] = "Non Authoritative Information";
  40. statusCodes[exports.NOT_ACCEPTABLE = 406] = "Not Acceptable";
  41. statusCodes[exports.NOT_FOUND = 404] = "Not Found";
  42. statusCodes[exports.NOT_IMPLEMENTED = 501] = "Not Implemented";
  43. statusCodes[exports.NOT_MODIFIED = 304] = "Not Modified";
  44. statusCodes[exports.OK = 200] = "OK";
  45. statusCodes[exports.PARTIAL_CONTENT = 206] = "Partial Content";
  46. statusCodes[exports.PAYMENT_REQUIRED = 402] = "Payment Required";
  47. statusCodes[exports.PRECONDITION_FAILED = 412] = "Precondition Failed";
  48. statusCodes[exports.PRECONDITION_REQUIRED = 428] = "Precondition Required";
  49. statusCodes[exports.PROCESSING = 102] = "Processing";
  50. statusCodes[exports.PROXY_AUTHENTICATION_REQUIRED = 407] = "Proxy Authentication Required";
  51. statusCodes[exports.REQUEST_HEADER_FIELDS_TOO_LARGE = 431] = "Request Header Fields Too Large";
  52. statusCodes[exports.REQUEST_TIMEOUT = 408] = "Request Timeout";
  53. statusCodes[exports.REQUEST_TOO_LONG = 413] = "Request Entity Too Large";
  54. statusCodes[exports.REQUEST_URI_TOO_LONG = 414] = "Request-URI Too Long";
  55. statusCodes[exports.REQUESTED_RANGE_NOT_SATISFIABLE = 416] = "Requested Range Not Satisfiable";
  56. statusCodes[exports.RESET_CONTENT = 205] = "Reset Content";
  57. statusCodes[exports.SEE_OTHER = 303] = "See Other";
  58. statusCodes[exports.SERVICE_UNAVAILABLE = 503] = "Service Unavailable";
  59. statusCodes[exports.SWITCHING_PROTOCOLS = 101] = "Switching Protocols";
  60. statusCodes[exports.TEMPORARY_REDIRECT = 307] = "Temporary Redirect";
  61. statusCodes[exports.TOO_MANY_REQUESTS = 429] = "Too Many Requests";
  62. statusCodes[exports.UNAUTHORIZED = 401] = "Unauthorized";
  63. statusCodes[exports.UNPROCESSABLE_ENTITY = 422] = "Unprocessable Entity";
  64. statusCodes[exports.UNSUPPORTED_MEDIA_TYPE = 415] = "Unsupported Media Type";
  65. statusCodes[exports.USE_PROXY = 305] = "Use Proxy";
  66.  
  67. exports.getStatusText = function(statusCode) {
  68.   if (statusCodes.hasOwnProperty(statusCode)) {
  69.     return statusCodes[statusCode];
  70.   } else {
  71.     throw new Error("Status code does not exist: " + statusCode);
  72.   }
  73. };
  74.  
  75.  
  76.  
  77. //////////////////
  78. // WEBPACK FOOTER
  79. // ../~/http-status-codes/index.js
  80. // module id = 137
  81. // module chunks = 0

Replies to /http-status-codes/index.js rss

Title Name Language When
/warning/browser.js disqus.com javascript 1 Year ago.

Reply to "/http-status-codes/index.js"

Here you can reply to the paste above