UNPKG

http-errors-enhanced-cjs

Version:

Create HTTP errors with additional properties for any framework.

606 lines (605 loc) 15.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); 0 && (module.exports = { ACCEPTED: null, ALREADY_REPORTED: null, BAD_GATEWAY: null, BAD_REQUEST: null, BANDWIDTH_LIMIT_EXCEEDED: null, CONFLICT: null, CONTINUE: null, CREATED: null, EARLY_HINTS: null, EXPECTATION_FAILED: null, FAILED_DEPENDENCY: null, FORBIDDEN: null, FOUND: null, GATEWAY_TIMEOUT: null, GONE: null, HTTPVERSION_NOT_SUPPORTED: null, IMA_TEAPOT: null, IMUSED: null, INSUFFICIENT_STORAGE: null, INTERNAL_SERVER_ERROR: null, LENGTH_REQUIRED: null, LOCKED: null, LOOP_DETECTED: null, METHOD_NOT_ALLOWED: null, MISDIRECTED_REQUEST: null, MOVED_PERMANENTLY: null, MULTIPLE_CHOICES: null, MULTI_STATUS: null, NETWORK_AUTHENTICATION_REQUIRED: null, NON_AUTHORITATIVE_INFORMATION: null, NOT_ACCEPTABLE: null, NOT_EXTENDED: null, NOT_FOUND: null, NOT_IMPLEMENTED: null, NOT_MODIFIED: null, NO_CONTENT: null, OK: null, PARTIAL_CONTENT: null, PAYLOAD_TOO_LARGE: null, PAYMENT_REQUIRED: null, PERMANENT_REDIRECT: null, PRECONDITION_FAILED: null, PRECONDITION_REQUIRED: null, PROCESSING: null, PROXY_AUTHENTICATION_REQUIRED: null, RANGE_NOT_SATISFIABLE: null, REQUEST_HEADER_FIELDS_TOO_LARGE: null, REQUEST_TIMEOUT: null, RESET_CONTENT: null, SEE_OTHER: null, SERVICE_UNAVAILABLE: null, SWITCHING_PROTOCOLS: null, TEMPORARY_REDIRECT: null, TOO_EARLY: null, TOO_MANY_REQUESTS: null, UNAUTHORIZED: null, UNAVAILABLE_FOR_LEGAL_REASONS: null, UNPROCESSABLE_ENTITY: null, UNSUPPORTED_MEDIA_TYPE: null, UPGRADE_REQUIRED: null, URITOO_LONG: null, USE_PROXY: null, VARIANT_ALSO_NEGOTIATES: null, codesByIdentifier: null, identifierByCodes: null, messagesByCodes: null, phrasesByCodes: null }); function _export(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: true, get: all[name] }); } _export(exports, { ACCEPTED: function() { return ACCEPTED; }, ALREADY_REPORTED: function() { return ALREADY_REPORTED; }, BAD_GATEWAY: function() { return BAD_GATEWAY; }, BAD_REQUEST: function() { return BAD_REQUEST; }, BANDWIDTH_LIMIT_EXCEEDED: function() { return BANDWIDTH_LIMIT_EXCEEDED; }, CONFLICT: function() { return CONFLICT; }, CONTINUE: function() { return CONTINUE; }, CREATED: function() { return CREATED; }, EARLY_HINTS: function() { return EARLY_HINTS; }, EXPECTATION_FAILED: function() { return EXPECTATION_FAILED; }, FAILED_DEPENDENCY: function() { return FAILED_DEPENDENCY; }, FORBIDDEN: function() { return FORBIDDEN; }, FOUND: function() { return FOUND; }, GATEWAY_TIMEOUT: function() { return GATEWAY_TIMEOUT; }, GONE: function() { return GONE; }, HTTPVERSION_NOT_SUPPORTED: function() { return HTTPVERSION_NOT_SUPPORTED; }, IMA_TEAPOT: function() { return IMA_TEAPOT; }, IMUSED: function() { return IMUSED; }, INSUFFICIENT_STORAGE: function() { return INSUFFICIENT_STORAGE; }, INTERNAL_SERVER_ERROR: function() { return INTERNAL_SERVER_ERROR; }, LENGTH_REQUIRED: function() { return LENGTH_REQUIRED; }, LOCKED: function() { return LOCKED; }, LOOP_DETECTED: function() { return LOOP_DETECTED; }, METHOD_NOT_ALLOWED: function() { return METHOD_NOT_ALLOWED; }, MISDIRECTED_REQUEST: function() { return MISDIRECTED_REQUEST; }, MOVED_PERMANENTLY: function() { return MOVED_PERMANENTLY; }, MULTIPLE_CHOICES: function() { return MULTIPLE_CHOICES; }, MULTI_STATUS: function() { return MULTI_STATUS; }, NETWORK_AUTHENTICATION_REQUIRED: function() { return NETWORK_AUTHENTICATION_REQUIRED; }, NON_AUTHORITATIVE_INFORMATION: function() { return NON_AUTHORITATIVE_INFORMATION; }, NOT_ACCEPTABLE: function() { return NOT_ACCEPTABLE; }, NOT_EXTENDED: function() { return NOT_EXTENDED; }, NOT_FOUND: function() { return NOT_FOUND; }, NOT_IMPLEMENTED: function() { return NOT_IMPLEMENTED; }, NOT_MODIFIED: function() { return NOT_MODIFIED; }, NO_CONTENT: function() { return NO_CONTENT; }, OK: function() { return OK; }, PARTIAL_CONTENT: function() { return PARTIAL_CONTENT; }, PAYLOAD_TOO_LARGE: function() { return PAYLOAD_TOO_LARGE; }, PAYMENT_REQUIRED: function() { return PAYMENT_REQUIRED; }, PERMANENT_REDIRECT: function() { return PERMANENT_REDIRECT; }, PRECONDITION_FAILED: function() { return PRECONDITION_FAILED; }, PRECONDITION_REQUIRED: function() { return PRECONDITION_REQUIRED; }, PROCESSING: function() { return PROCESSING; }, PROXY_AUTHENTICATION_REQUIRED: function() { return PROXY_AUTHENTICATION_REQUIRED; }, RANGE_NOT_SATISFIABLE: function() { return RANGE_NOT_SATISFIABLE; }, REQUEST_HEADER_FIELDS_TOO_LARGE: function() { return REQUEST_HEADER_FIELDS_TOO_LARGE; }, REQUEST_TIMEOUT: function() { return REQUEST_TIMEOUT; }, RESET_CONTENT: function() { return RESET_CONTENT; }, SEE_OTHER: function() { return SEE_OTHER; }, SERVICE_UNAVAILABLE: function() { return SERVICE_UNAVAILABLE; }, SWITCHING_PROTOCOLS: function() { return SWITCHING_PROTOCOLS; }, TEMPORARY_REDIRECT: function() { return TEMPORARY_REDIRECT; }, TOO_EARLY: function() { return TOO_EARLY; }, TOO_MANY_REQUESTS: function() { return TOO_MANY_REQUESTS; }, UNAUTHORIZED: function() { return UNAUTHORIZED; }, UNAVAILABLE_FOR_LEGAL_REASONS: function() { return UNAVAILABLE_FOR_LEGAL_REASONS; }, UNPROCESSABLE_ENTITY: function() { return UNPROCESSABLE_ENTITY; }, UNSUPPORTED_MEDIA_TYPE: function() { return UNSUPPORTED_MEDIA_TYPE; }, UPGRADE_REQUIRED: function() { return UPGRADE_REQUIRED; }, URITOO_LONG: function() { return URITOO_LONG; }, USE_PROXY: function() { return USE_PROXY; }, VARIANT_ALSO_NEGOTIATES: function() { return VARIANT_ALSO_NEGOTIATES; }, codesByIdentifier: function() { return codesByIdentifier; }, identifierByCodes: function() { return identifierByCodes; }, messagesByCodes: function() { return messagesByCodes; }, phrasesByCodes: function() { return phrasesByCodes; } }); const identifierByCodes = { 100: 'Continue', 101: 'SwitchingProtocols', 102: 'Processing', 103: 'EarlyHints', 200: 'OK', 201: 'Created', 202: 'Accepted', 203: 'NonAuthoritativeInformation', 204: 'NoContent', 205: 'ResetContent', 206: 'PartialContent', 207: 'MultiStatus', 208: 'AlreadyReported', 226: 'IMUsed', 300: 'MultipleChoices', 301: 'MovedPermanently', 302: 'Found', 303: 'SeeOther', 304: 'NotModified', 305: 'UseProxy', 307: 'TemporaryRedirect', 308: 'PermanentRedirect', 400: 'BadRequest', 401: 'Unauthorized', 402: 'PaymentRequired', 403: 'Forbidden', 404: 'NotFound', 405: 'MethodNotAllowed', 406: 'NotAcceptable', 407: 'ProxyAuthenticationRequired', 408: 'RequestTimeout', 409: 'Conflict', 410: 'Gone', 411: 'LengthRequired', 412: 'PreconditionFailed', 413: 'PayloadTooLarge', 414: 'URITooLong', 415: 'UnsupportedMediaType', 416: 'RangeNotSatisfiable', 417: 'ExpectationFailed', 418: 'ImaTeapot', 421: 'MisdirectedRequest', 422: 'UnprocessableEntity', 423: 'Locked', 424: 'FailedDependency', 425: 'TooEarly', 426: 'UpgradeRequired', 428: 'PreconditionRequired', 429: 'TooManyRequests', 431: 'RequestHeaderFieldsTooLarge', 451: 'UnavailableForLegalReasons', 500: 'InternalServerError', 501: 'NotImplemented', 502: 'BadGateway', 503: 'ServiceUnavailable', 504: 'GatewayTimeout', 505: 'HTTPVersionNotSupported', 506: 'VariantAlsoNegotiates', 507: 'InsufficientStorage', 508: 'LoopDetected', 509: 'BandwidthLimitExceeded', 510: 'NotExtended', 511: 'NetworkAuthenticationRequired' }; const codesByIdentifier = { Continue: 100, SwitchingProtocols: 101, Processing: 102, EarlyHints: 103, OK: 200, Created: 201, Accepted: 202, NonAuthoritativeInformation: 203, NoContent: 204, ResetContent: 205, PartialContent: 206, MultiStatus: 207, AlreadyReported: 208, IMUsed: 226, MultipleChoices: 300, MovedPermanently: 301, Found: 302, SeeOther: 303, NotModified: 304, UseProxy: 305, TemporaryRedirect: 307, PermanentRedirect: 308, BadRequest: 400, Unauthorized: 401, PaymentRequired: 402, Forbidden: 403, NotFound: 404, MethodNotAllowed: 405, NotAcceptable: 406, ProxyAuthenticationRequired: 407, RequestTimeout: 408, Conflict: 409, Gone: 410, LengthRequired: 411, PreconditionFailed: 412, PayloadTooLarge: 413, URITooLong: 414, UnsupportedMediaType: 415, RangeNotSatisfiable: 416, ExpectationFailed: 417, ImaTeapot: 418, MisdirectedRequest: 421, UnprocessableEntity: 422, Locked: 423, FailedDependency: 424, TooEarly: 425, UpgradeRequired: 426, PreconditionRequired: 428, TooManyRequests: 429, RequestHeaderFieldsTooLarge: 431, UnavailableForLegalReasons: 451, InternalServerError: 500, NotImplemented: 501, BadGateway: 502, ServiceUnavailable: 503, GatewayTimeout: 504, HTTPVersionNotSupported: 505, VariantAlsoNegotiates: 506, InsufficientStorage: 507, LoopDetected: 508, BandwidthLimitExceeded: 509, NotExtended: 510, NetworkAuthenticationRequired: 511 }; const messagesByCodes = { 100: 'Continue', 101: 'Switching Protocols', 102: 'Processing', 103: 'Early Hints', 200: 'OK', 201: 'Created', 202: 'Accepted', 203: 'Non-Authoritative Information', 204: 'No Content', 205: 'Reset Content', 206: 'Partial Content', 207: 'Multi-Status', 208: 'Already Reported', 226: 'IM Used', 300: 'Multiple Choices', 301: 'Moved Permanently', 302: 'Found', 303: 'See Other', 304: 'Not Modified', 305: 'Use Proxy', 307: 'Temporary Redirect', 308: 'Permanent Redirect', 400: 'Bad Request', 401: 'Unauthorized', 402: 'Payment Required', 403: 'Forbidden', 404: 'Not Found', 405: 'Method Not Allowed', 406: 'Not Acceptable', 407: 'Proxy Authentication Required', 408: 'Request Timeout', 409: 'Conflict', 410: 'Gone', 411: 'Length Required', 412: 'Precondition Failed', 413: 'Payload Too Large', 414: 'URI Too Long', 415: 'Unsupported Media Type', 416: 'Range Not Satisfiable', 417: 'Expectation Failed', 418: "I'm a Teapot", 421: 'Misdirected Request', 422: 'Unprocessable Entity', 423: 'Locked', 424: 'Failed Dependency', 425: 'Too Early', 426: 'Upgrade Required', 428: 'Precondition Required', 429: 'Too Many Requests', 431: 'Request Header Fields Too Large', 451: 'Unavailable For Legal Reasons', 500: 'Internal Server Error', 501: 'Not Implemented', 502: 'Bad Gateway', 503: 'Service Unavailable', 504: 'Gateway Timeout', 505: 'HTTP Version Not Supported', 506: 'Variant Also Negotiates', 507: 'Insufficient Storage', 508: 'Loop Detected', 509: 'Bandwidth Limit Exceeded', 510: 'Not Extended', 511: 'Network Authentication Required' }; const phrasesByCodes = { 100: 'Continue.', 101: 'Switching protocols.', 102: 'Processing.', 103: 'Early hints.', 200: 'Ok.', 201: 'Created.', 202: 'Accepted.', 203: 'Non-authoritative information.', 204: 'No content.', 205: 'Reset content.', 206: 'Partial content.', 207: 'Multi-status.', 208: 'Already reported.', 226: 'Im used.', 300: 'Multiple choices.', 301: 'Moved permanently.', 302: 'Found.', 303: 'See other.', 304: 'Not modified.', 305: 'Use proxy.', 307: 'Temporary redirect.', 308: 'Permanent redirect.', 400: 'Bad request.', 401: 'Unauthorized.', 402: 'Payment required.', 403: 'Forbidden.', 404: 'Not found.', 405: 'Method not allowed.', 406: 'Not acceptable.', 407: 'Proxy authentication required.', 408: 'Request timeout.', 409: 'Conflict.', 410: 'Gone.', 411: 'Length required.', 412: 'Precondition failed.', 413: 'Payload too large.', 414: 'Uri too long.', 415: 'Unsupported media type.', 416: 'Range not satisfiable.', 417: 'Expectation failed.', 418: "I'm a teapot.", 421: 'Misdirected request.', 422: 'Unprocessable entity.', 423: 'Locked.', 424: 'Failed dependency.', 425: 'Too early.', 426: 'Upgrade required.', 428: 'Precondition required.', 429: 'Too many requests.', 431: 'Request header fields too large.', 451: 'Unavailable for legal reasons.', 500: 'Internal server error.', 501: 'Not implemented.', 502: 'Bad gateway.', 503: 'Service unavailable.', 504: 'Gateway timeout.', 505: 'Http version not supported.', 506: 'Variant also negotiates.', 507: 'Insufficient storage.', 508: 'Loop detected.', 509: 'Bandwidth limit exceeded.', 510: 'Not extended.', 511: 'Network authentication required.' }; const CONTINUE = 100; const SWITCHING_PROTOCOLS = 101; const PROCESSING = 102; const EARLY_HINTS = 103; const OK = 200; const CREATED = 201; const ACCEPTED = 202; const NON_AUTHORITATIVE_INFORMATION = 203; const NO_CONTENT = 204; const RESET_CONTENT = 205; const PARTIAL_CONTENT = 206; const MULTI_STATUS = 207; const ALREADY_REPORTED = 208; const IMUSED = 226; const MULTIPLE_CHOICES = 300; const MOVED_PERMANENTLY = 301; const FOUND = 302; const SEE_OTHER = 303; const NOT_MODIFIED = 304; const USE_PROXY = 305; const TEMPORARY_REDIRECT = 307; const PERMANENT_REDIRECT = 308; const BAD_REQUEST = 400; const UNAUTHORIZED = 401; const PAYMENT_REQUIRED = 402; const FORBIDDEN = 403; const NOT_FOUND = 404; const METHOD_NOT_ALLOWED = 405; const NOT_ACCEPTABLE = 406; const PROXY_AUTHENTICATION_REQUIRED = 407; const REQUEST_TIMEOUT = 408; const CONFLICT = 409; const GONE = 410; const LENGTH_REQUIRED = 411; const PRECONDITION_FAILED = 412; const PAYLOAD_TOO_LARGE = 413; const URITOO_LONG = 414; const UNSUPPORTED_MEDIA_TYPE = 415; const RANGE_NOT_SATISFIABLE = 416; const EXPECTATION_FAILED = 417; const IMA_TEAPOT = 418; const MISDIRECTED_REQUEST = 421; const UNPROCESSABLE_ENTITY = 422; const LOCKED = 423; const FAILED_DEPENDENCY = 424; const TOO_EARLY = 425; const UPGRADE_REQUIRED = 426; const PRECONDITION_REQUIRED = 428; const TOO_MANY_REQUESTS = 429; const REQUEST_HEADER_FIELDS_TOO_LARGE = 431; const UNAVAILABLE_FOR_LEGAL_REASONS = 451; const INTERNAL_SERVER_ERROR = 500; const NOT_IMPLEMENTED = 501; const BAD_GATEWAY = 502; const SERVICE_UNAVAILABLE = 503; const GATEWAY_TIMEOUT = 504; const HTTPVERSION_NOT_SUPPORTED = 505; const VARIANT_ALSO_NEGOTIATES = 506; const INSUFFICIENT_STORAGE = 507; const LOOP_DETECTED = 508; const BANDWIDTH_LIMIT_EXCEEDED = 509; const NOT_EXTENDED = 510; const NETWORK_AUTHENTICATION_REQUIRED = 511;