Skip to content

Instantly share code, notes, and snippets.

@dmvt
Created January 29, 2014 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmvt/8682326 to your computer and use it in GitHub Desktop.
Save dmvt/8682326 to your computer and use it in GitHub Desktop.
Provides a JavaScript object on window for translating http status codes into strings
// string responses from http://httpstatus.es/
(function(window) {
window.httpStatusCodeMap = {
100: 'Client should continue with request',
101: 'Server is switching protocols',
102: 'Server has received and is processing the request',
103: 'Resume aborted PUT or POST requests',
122: 'URI is longer than a maximum of 2083 characters',
200: 'Standard response for successful HTTP requests',
201: 'Request has been fulfilled; new resource created',
202: 'Request accepted, processing pending',
203: 'Request processed, information may be from another source',
204: 'Request processed, no content returned',
205: 'Request processed, no content returned, reset document view',
206: 'Partial resource return due to request header',
207: 'XML, can contain multiple separate responses',
208: 'Results previously returned',
226: 'Request fulfilled, reponse is instance-manipulations',
300: 'Multiple options for the resource delivered',
301: 'This and all future requests directed to the given URI',
302: 'Temporary response to request found via alternative URI',
303: 'Permanent response to request found via alternative URI',
304: 'Resource has not been modified since last requested',
305: 'Content located elsewhere, retrieve from there',
306: 'Subsequent requests should use the specified proxy',
307: 'Connect again to different URI as provided',
308: 'This request can be resumed',
400: 'Request cannot be fulfilled due to bad syntax',
401: 'Authentication is possible but has failed',
402: 'Payment required, reserved for future use',
403: 'Server refuses to respond to request',
404: 'Requested resource could not be found',
405: 'Request method not supported by that resource',
406: 'Content not acceptable according to the Accept headers',
407: 'Client must first authenticate itself with the proxy',
408: 'Server timed out waiting for the request',
409: 'Request could not be processed because of conflict',
410: 'Resource is no longer available and will not be available again',
411: 'Request did not specify the length of its content',
412: 'Server does not meet request preconditions',
413: 'Request is larger than the server is willing or able to process',
414: 'URI provided was too long for the server to process',
415: 'Server does not support media type',
416: 'Client has asked for unprovidable portion of the file',
417: 'Server cannot meet requirements of Expect request-header field',
418: 'I\'m a teapot',
420: 'Twitter rate limit exceeded',
422: 'Request unable to be followed due to semantic errors',
423: 'Resource that is being accessed is locked',
424: 'Request failed due to failure of a previous request',
426: 'Client should switch to a different protocol',
428: 'Origin server requires the request to be conditional',
429: 'User has sent too many requests in a given amount of time',
431: 'Server is unwilling to process the request',
444: 'Server returns no information and closes the connection',
449: 'Request should be retried after performing action',
450: 'Windows Parental Controls blocking access to webpage',
451: 'The server cannot reach the client\'s mailbox.',
499: 'Connection closed by client while HTTP server is processing',
500: 'Server error',
501: 'Server does not recognise method or lacks ability to fulfill',
502: 'Server received an invalid response from upstream server',
503: 'Server is currently unavailable',
504: 'Gateway did not receive response from upstream server',
505: 'Server does not support the HTTP protocol version',
506: 'Content negotiation for the request results in a circular reference',
507: 'Server is unable to store the representation',
508: 'Server detected an infinite loop while processing the request',
509: 'Bandwidth limit exceeded',
510: 'Further extensions to the request are required',
511: 'Client needs to authenticate to gain network access',
598: 'Network read timeout behind the proxy',
599: 'Network connect timeout behind the proxy'
}
}(window));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment