UNPKG

http-response-status-code

Version:

A lightweight utility for retrieving HTTP status codes, names, and descriptions. Easily validate, categorize, and manage HTTP responses with built-in methods for informational, success, redirection, client, and server error codes.

73 lines (72 loc) 2.36 kB
"use strict"; var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.ClassLimits = exports.ClassTypes = void 0; /** * The HTTP status code class types. * @constant {Object<string, string>} */ exports.ClassTypes = { INFORMATIONAL: "Informational", SUCCESS: "Success", REDIRECTION: "Redirectional", CLIENT_ERROR: "ClientError", SERVER_ERROR: "ServerError", }; /** * The class limits for HTTP status codes. * @constant {IClassLimits} ClassLimits - The class limits for HTTP status codes. * @type {Object<string, {MIN: number, MAX: number}>} */ exports.ClassLimits = (_a = {}, /** * Informational status codes (100-199). * @property {Object} * @property {number} MIN - The minimum value for informational status codes. * @property {number} MAX - The maximum value for informational status codes. */ _a[exports.ClassTypes.INFORMATIONAL] = { MIN: 100, MAX: 199, }, /** * Success status codes (200-299). * @property {Object} * @property {number} MIN - The minimum value for success status codes. * @property {number} MAX - The maximum value for success status codes. */ _a[exports.ClassTypes.SUCCESS] = { MIN: 200, MAX: 299, }, /** * Redirectional status codes (300-399). * @property {Object} * @property {number} MIN - The minimum value for redirection status codes. * @property {number} MAX - The maximum value for redirection status codes. */ _a[exports.ClassTypes.REDIRECTION] = { MIN: 300, MAX: 399, }, /** * Client error status codes (400-499). * @property {Object} * @property {number} MIN - The minimum value for client error status codes. * @property {number} MAX - The maximum value for client error status codes. */ _a[exports.ClassTypes.CLIENT_ERROR] = { MIN: 400, MAX: 499, }, /** * Server error status codes (500-599). * @property {Object} * @property {number} MIN - The minimum value for server error status codes. * @property {number} MAX - The maximum value for server error status codes. */ _a[exports.ClassTypes.SERVER_ERROR] = { MIN: 500, MAX: 599, }, _a);