2.0.0 • Published 2 months ago

http-foundation-response v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
2 months ago

http-foundation-response

Constants enumerating the HTTP status codes, and HTTP status texts.

Constants enumerating the HTTP status codes. All status codes defined in RFC1945 (HTTP/1.0, RFC2616 (HTTP/1.1), and RFC2518 (WebDAV) are supported.

No dependencies.

Installation

npm install http-foundation-response --save

Usage

const HttpStatus = require('http-foundation-response');
// OR
import * as HttpCodes from 'http-foundation-response';


console.log(HttpCodes.OK); //200
console.log(HttpCodes.getStatusText(HttpCodes.OK)); //OK
console.log(HttpCodes.getStatusCode('OK')); //200

Codes

ConstantCodeStatus Text
CONTINUE100Continue
SWITCHING_PROTOCOLS101Switching Protocols
PROCESSING102Processing // RFC2518
EARLY_HINTS103Early Hints
OK200OK
CREATED201Created
ACCEPTED202Accepted
NON_AUTHORITATIVE_INFORMATION203Non-Authoritative Information
NO_CONTENT204No Content
RESET_CONTENT205Reset Content
PARTIAL_CONTENT206Partial Content
MULTI_STATUS207Multi-Status // RFC4918
ALREADY_REPORTED208Already Reported // RFC5842
IM_USED226IM Used // RFC3229
MULTIPLE_CHOICES300Multiple Choices
MOVED_PERMANENTLY301Moved Permanently
FOUND302Found
SEE_OTHER303See Other
NOT_MODIFIED304Not Modified
USE_PROXY305Use Proxy
RESERVED306(Unused) status code was used in a previous version of the specification, is no longer used, and the code is reserved.
TEMPORARY_REDIRECT307Temporary Redirect
PERMANENTLY_REDIRECT308Permanent Redirect // RFC7238
BAD_REQUEST400Bad Request
UNAUTHORIZED401Unauthorized
PAYMENT_REQUIRED402Payment Required
FORBIDDEN403Forbidden
NOT_FOUND404Not Found
METHOD_NOT_ALLOWED405Method Not Allowed
NOT_ACCEPTABLE406Not Acceptable
PROXY_AUTHENTICATION_REQUIRED407Proxy Authentication Required
REQUEST_TIMEOUT408Request Timeout
CONFLICT409Conflict
GONE410Gone
LENGTH_REQUIRED411Length Required
PRECONDITION_FAILED412Precondition Failed
REQUEST_ENTITY_TOO_LARGE413Payload Too Large
REQUEST_URI_TOO_LONG414URI Too Long
UNSUPPORTED_MEDIA_TYPE415Unsupported Media Type
REQUESTED_RANGE_NOT_SATISFIABLE416Range Not Satisfiabl
EXPECTATION_FAILED417Expectation Failed
I_AM_A_TEAPOT418I'm a teapot // RFC2324
INSUFFICIENT_SPACE_ON_RESOURCE419Insufficient Space on Resource
METHOD_FAILURE420Method Failure
MISDIRECTED_REQUEST421Misdirected Request // RFC7540
UNPROCESSABLE_ENTITY422Unprocessable Entity // RFC4918
LOCKED423Locked // RFC4918
FAILED_DEPENDENCY424Failed Dependency // RFC4918

Deprecated codes

ConstantCodeStatus Text
TOO_EARLY425Too Early // RFC-ietf-httpbis-replay-04
UPGRADE_REQUIRED426Upgrade Required // RFC2817
PRECONDITION_REQUIRED428Precondition Required // RFC6585
TOO_MANY_REQUESTS429Too Many Requests // RFC6585
REQUEST_HEADER_FIELDS_TOO_LARGE431Request Header Fields Too Large // RFC6585
UNAVAILABLE_FOR_LEGAL_REASONS451Unavailable For Legal Reasons // RFC7725
INTERNAL_SERVER_ERROR500Internal Server Error
NOT_IMPLEMENTED501Not Implemented
BAD_GATEWAY502Bad Gateway
SERVICE_UNAVAILABLE503Service Unavailable
GATEWAY_TIMEOUT504Gateway Timeout
HTTP_VERSION_NOT_SUPPORTED505HTTP Version Not Supported
VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL506Variant Also Negotiates
INSUFFICIENT_STORAGE507Insufficient Storage
LOOP_DETECTED508Loop Detected
NOT_EXTENDED510Not Extended
NETWORK_AUTHENTICATION_REQUIRED511Network Authentication Required