http-toolkit
Version:
Well-documented toolkit for making elegant HTTP requests with JavaScript
298 lines (293 loc) • 6.12 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.HttpStatus = void 0;
/* eslint-disable quotes */
/**
* @module HttpStatus
* @category Models and Constants
*/
/**
* @typedef {Object} HttpStatus
* @property {number} code - The HTTP code
* @property {string} key - Unique identifier
* @property {string} message - Short user-friendly description
*/
/**
* @readonly
* @property {HttpStatus} HTTP_STATUS { code: 000, message: 'Message', key: HTTP_STATUS }
*/
var HttpStatus = {
ACCEPTED: {
key: 'ACCEPTED',
code: 202,
message: 'Accepted'
},
BAD_GATEWAY: {
key: 'BAD_GATEWAY',
code: 502,
message: 'Bad Gateway'
},
BAD_REQUEST: {
key: 'BAD_REQUEST',
code: 400,
message: 'Bad Request'
},
CONFLICT: {
key: 'CONFLICT',
code: 409,
message: 'Conflict'
},
CONTINUE: {
key: 'CONTINUE',
code: 100,
message: 'Continue'
},
CREATED: {
key: 'CREATED',
code: 201,
message: 'Created'
},
EXPECTATION_FAILED: {
key: 'EXPECTATION_FAILED',
code: 417,
message: 'Expectation Failed'
},
FAILED_DEPENDENCY: {
key: 'FAILED_DEPENDENCY',
code: 424,
message: 'Failed Dependency'
},
FORBIDDEN: {
key: 'FORBIDDEN',
code: 403,
message: 'Forbidden'
},
GATEWAY_TIMEOUT: {
key: 'GATEWAY_TIMEOUT',
code: 504,
message: 'Gateway Timeout'
},
GONE: {
key: 'GONE',
code: 410,
message: 'Gone'
},
HTTP_VERSION_NOT_SUPPORTED: {
key: 'HTTP_VERSION_NOT_SUPPORTED',
code: 505,
message: 'HTTP Version Not Supported'
},
IM_A_TEAPOT: {
key: 'IM_A_TEAPOT',
code: 418,
message: "I'm a teapot"
},
INSUFFICIENT_SPACE_ON_RESOURCE: {
key: 'INSUFFICIENT_SPACE_ON_RESOURCE',
code: 419,
message: 'Insufficient Space on Resource'
},
INSUFFICIENT_STORAGE: {
key: 'INSUFFICIENT_STORAGE',
code: 507,
message: 'Insufficient Storage'
},
INTERNAL_SERVER_ERROR: {
key: 'INTERNAL_SERVER_ERROR',
code: 500,
message: 'Server Error'
},
LENGTH_REQUIRED: {
key: 'LENGTH_REQUIRED',
code: 411,
message: 'Length Required'
},
LOCKED: {
key: 'LOCKED',
code: 423,
message: 'Locked'
},
METHOD_FAILURE: {
key: 'METHOD_FAILURE',
code: 420,
message: 'Method Failure'
},
METHOD_NOT_ALLOWED: {
key: 'METHOD_NOT_ALLOWED',
code: 405,
message: 'Method Not Allowed'
},
MOVED_PERMANENTLY: {
key: 'MOVED_PERMANENTLY',
code: 301,
message: 'Moved Permanently'
},
MOVED_TEMPORARILY: {
key: 'MOVED_TEMPORARILY',
code: 302,
message: 'Moved Temporarily'
},
MULTI_STATUS: {
key: 'MULTI_STATUS',
code: 207,
message: 'Multi-Status'
},
MULTIPLE_CHOICES: {
key: 'MULTIPLE_CHOICES',
code: 300,
message: 'Multiple Choices'
},
NETWORK_AUTHENTICATION_REQUIRED: {
key: 'NETWORK_AUTHENTICATION_REQUIRED',
code: 511,
message: 'Network Authentication Required'
},
NO_CONTENT: {
key: 'NO_CONTENT',
code: 204,
message: 'No Content'
},
NON_AUTHORITATIVE_INFORMATION: {
key: 'NON_AUTHORITATIVE_INFORMATION',
code: 203,
message: 'Non Authoritative Information'
},
NOT_ACCEPTABLE: {
key: 'NOT_ACCEPTABLE',
code: 406,
message: 'Not Acceptable'
},
NOT_FOUND: {
key: 'NOT_FOUND',
code: 404,
message: 'Not Found'
},
NOT_IMPLEMENTED: {
key: 'NOT_IMPLEMENTED',
code: 501,
message: 'Not Implemented'
},
NOT_MODIFIED: {
key: 'NOT_MODIFIED',
code: 304,
message: 'Not Modified'
},
OK: {
key: 'OK',
code: 200,
message: 'OK'
},
PARTIAL_CONTENT: {
key: 'PARTIAL_CONTENT',
code: 206,
message: 'Partial Content'
},
PAYMENT_REQUIRED: {
key: 'PAYMENT_REQUIRED',
code: 402,
message: 'Payment Required'
},
PERMANENT_REDIRECT: {
key: 'PERMANENT_REDIRECT',
code: 308,
message: 'Permanent Redirect'
},
PRECONDITION_FAILED: {
key: 'PRECONDITION_FAILED',
code: 412,
message: 'Precondition Failed'
},
PRECONDITION_REQUIRED: {
key: 'PRECONDITION_REQUIRED',
code: 428,
message: 'Precondition Required'
},
PROCESSING: {
key: 'PROCESSING',
code: 102,
message: 'Processing'
},
PROXY_AUTHENTICATION_REQUIRED: {
key: 'PROXY_AUTHENTICATION_REQUIRED',
code: 407,
message: 'Proxy Authentication Required'
},
REQUEST_HEADER_FIELDS_TOO_LARGE: {
key: 'REQUEST_HEADER_FIELDS_TOO_LARGE',
code: 431,
message: 'Request Header Fields Too Large'
},
REQUEST_TIMEOUT: {
key: 'REQUEST_TIMEOUT',
code: 408,
message: 'Request Timeout'
},
REQUEST_TOO_LONG: {
key: 'REQUEST_TOO_LONG',
code: 413,
message: 'Request Entity Too Large'
},
REQUEST_URI_TOO_LONG: {
key: 'REQUEST_URI_TOO_LONG',
code: 414,
message: 'Request-URI Too Long'
},
REQUESTED_RANGE_NOT_SATISFIABLE: {
key: 'REQUESTED_RANGE_NOT_SATISFIABLE',
code: 416,
message: 'Requested Range Not Satisfiable'
},
RESET_CONTENT: {
key: 'RESET_CONTENT',
code: 205,
message: 'Reset Content'
},
SEE_OTHER: {
key: 'SEE_OTHER',
code: 303,
message: 'See Other'
},
SERVICE_UNAVAILABLE: {
key: 'SERVICE_UNAVAILABLE',
code: 503,
message: 'Service Unavailable'
},
SWITCHING_PROTOCOLS: {
key: 'SWITCHING_PROTOCOLS',
code: 101,
message: 'Switching Protocols'
},
TEMPORARY_REDIRECT: {
key: 'TEMPORARY_REDIRECT',
code: 307,
message: 'Temporary Redirect'
},
TOO_MANY_REQUESTS: {
key: 'TOO_MANY_REQUESTS',
code: 429,
message: 'Too Many Requests'
},
UNAUTHORIZED: {
key: 'UNAUTHORIZED',
code: 401,
message: 'Unauthorized'
},
UNPROCESSABLE_ENTITY: {
key: 'UNPROCESSABLE_ENTITY',
code: 422,
message: 'Unprocessable Entity'
},
UNSUPPORTED_MEDIA_TYPE: {
key: 'UNSUPPORTED_MEDIA_TYPE',
code: 415,
message: 'Unsupported Media Type'
},
USE_PROXY: {
key: 'USE_PROXY',
code: 305,
message: 'Use Proxy'
}
};
exports.HttpStatus = HttpStatus;