1.0.1 • Published 5 years ago

response-status-codes v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

response-status-codes:

This is a list of Hypertext Transfer Protocol (HTTP) response status codes.Status codes are issued by a server in response to a client's request made to the server. It includes codes from IETF Request for Comments (RFCs), other specifications, and some additional codes used in some common applications of the Hypertext Transfer Protocol (HTTP).
All HTTP response status codes are separated into five classes (or categories). The first digit of the status code defines the class of response. The last two digits do not have any class or categorization role. There are five values for the first digit:

  • 1xx (Informational): The request was received, continuing process
  • 2xx (Successful): The request was successfully received, understood and accepted
  • 3xx (Redirection): Further action needs to be taken in order to complete the request
  • 4xx (Client Error): The request contains bad syntax or cannot be fulfilled
  • 5xx (Server Error): The server failed to fulfill an apparently valid request

Installation:

npm i --save response-status-codes

Usage (expressjs):

const express = require('express');
const statusCodes = require('response-status-codes');

const app = express();
app.use((req, res, next)=>{
    ...
    res.status(statusCodes.OK).send(data)
})

HTTP status codes and descriptions:

NameCodeDescription
---1xxInformational
Continue100Continue
SwitchingProtocols101Switching Protocols
Processing102Processing
EarlyHints103Early Hints
---2xxSuccess
OK200OK
Created201Created
Accepted202Accepted
NonAuthoritativeInformation203Nona-uthoritative Information
NoContent204No Content
ResetContent205Reset Content
PartialContent206Partial Content
MultiStatus207Multi-Status
AlreadyReported208Already Reported
IMUsed226IM Used
---3xxRedirection
MultipleChoices300Multiple Choices
MovedPermanently301Moved Permanently
Found302Found
SeeOther303See Other
NotModified304Not Modified
UseProxy305Use Proxy
TemporaryRedirect307Temporary Redirect
PermanentRedirect308Permanent Redirect
---4xxClient Error
BadRequest400Bad Request
Unauthorized401Unauthorized
PaymentRequired402Payment Required
Forbidden403Forbidden
NotFound404Not Found
MethodNotAllowed405Method Not Allowed
NotAcceptable406Not Acceptable
ProxyAuthenticationRequired407Proxy Authentication Required
RequestTimeout408Request Timeout
Conflict409Conflict
Gone410Gone
LengthRequired411Length Required
PreconditionFailed412Precondition Failed
PayloadTooLarge413Payload Too Large
RequestURITooLong414Request-URI Too Long
UnsupportedMediaType415Unsupported Media Type
RequestedRangeNotSatisfiable416Requested Range Not Satisfiable
ExpectationFailed417Expectation Failed
ImATeapot418I'm a teapot
MisdirectedRequest421Misdirected Request
UnprocessableEntity422Unprocessable Entity
Locked423Locked
FailedDependency424Failed Dependency
UpgradeRequired426Upgrade Required
PreconditionRequired428Precondition Required
TooManyRequests429Too Many Requests
RequestHeaderFieldsTooLarge431Request Header Fields Too Large
ConnectionClosedWithoutResponse444Connection Closed Without Response
UnavailableForLegalReasons451Unavailable For Legal Reasons
ClientClosedRequest499Client Closed Request
---5xxServer Error
InternalServerError500Internal Server Error
NotImplemented501Not Implemented
BadGateway502Bad Gateway
ServiceUnavailable503Service Unavailable
GatewayTimeout504Gateway Timeout
HTTPVersionNotSupported505HTTP Version Not Supported
VariantAlsoNegotiates506Variant Also Negotiates
InsufficientStorage507Insufficient Storage
LoopDetected508Loop Detected
NotExtended510Not Extended
NetworkAuthenticationRequired511Network Authentication Required
NetworkConnectTimeoutError599Network Connect Timeout Error

References:

License:

MIT