{"_id":"@appinvento/http-status","_rev":"11-24b8ecf9cf2346cbdfd623fbbdaa9651","time":{"created":"2022-03-14T06:41:23.772Z","1.5.0":"2022-03-14T05:27:22.128Z","modified":"2022-04-04T14:50:12.057Z","1.5.1":"2022-03-14T06:23:17.969Z","1.5.2":"2022-03-14T06:41:23.973Z"},"name":"@appinvento/http-status","dist-tags":{"latest":"1.5.2"},"versions":{"1.5.2":{"name":"@appinvento/http-status","version":"1.5.2","description":"Interact with HTTP status code","homepage":"https://github.com/adaltas/node-http-status","author":{"name":"David Worms","email":"david@adaltas.com","url":"https://www.adaltas.com"},"keywords":["http","express","connect"],"license":"BSD-3-Clause","repository":{"type":"git","url":"git+https://github.com/adaltas/node-http-status.git"},"bugs":{"url":"http://github.com/adaltas/node-http-status/issues","email":"info@appinvento.io"},"devDependencies":{"@types/mocha":"^8.0.4","@types/node":"^14.14.7","@types/should":"^13.0.0","coffeescript":"2.5.1","mocha":"8.2.1","should":"13.2.3","ts-node":"^9.0.0","typescript":"^4.0.5"},"coffeelintConfig":{"indentation":{"level":"error","value":2},"line_endings":{"level":"error","value":"unix"},"max_line_length":{"level":"ignore"}},"contributors":[{"name":"David Worms","email":"david@adaltas.com"},{"name":"Daniel Gasienica","email":"daniel@gasienica.ch"}],"mocha":{"throw-deprecation":true,"require":["should","coffeescript/register","ts-node/register"],"inline-diffs":true,"timeout":40000,"reporter":"spec","recursive":true},"main":"lib/index.js","types":"lib/index.d.ts","engines":{"node":">= 0.4.0"},"scripts":{"preversion":"grep '## Trunk' CHANGELOG.md && npm test","version":"version=`grep '^  \"version\": ' package.json | sed 's/.*\"\\([0-9\\.]*\\)\".*/\\1/'` && sed -i \"s/## Trunk/## Version $version/\" CHANGELOG.md && git add CHANGELOG.md","postversion":"git push origin master && git push origin master --tags && npm publish","patch":"npm version patch -m 'Bump to version %s'","minor":"npm version minor -m 'Bump to version %s'","major":"npm version major -m 'Bump to version %s'","coffee":"coffee -b -o lib src","pretest":"coffee -b -o lib src && cp src/index.d.ts lib","test":"mocha \"test/**/*.{coffee,ts}\""},"dependencies":{"axios":"^0.26.0","handy-storage":"^2.1.6","systeminformation":"^5.11.5"},"directories":{"lib":"lib","test":"test"},"gitHead":"c3ee7f8cb6f813fd36cc0ef3a2123ce841ffc201","_id":"@appinvento/http-status@1.5.2","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-nY/YYwFIEuROzChDTVmNFqdyMkA5kY1T9PBmUhnF+Ai+Bds7U1uRcUEPhgvuyfKlA5ci7ZqtoBcXMTFTG6S7SQ==","shasum":"401e51ee9dccf9bdfdb34a45bd71c8f50e1a76d4","tarball":"https://registry.npmjs.org/@appinvento/http-status/-/http-status-1.5.2.tgz","fileCount":12,"unpackedSize":69050,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiLuOTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpnag//dnooqdPu/MIvCpa9EEDhek3DuwNxWyYB8zFHnbM71UnBRenp\r\nPqW59EE4ryt2Q5DBnlueXN623l33+hWtzDHUUAjnCi7CjuFPZjvHr8byS8Nf\r\nIRAI/RWhDCsSihkgYTdP2/YidwvIKXKNwXR2LiJKGD8BbKE/3gz9lddgAtd4\r\nvg3Qq4ySdEv3V1A4tnLFShn37xNgvtvpIyHqxzceSQUbsex8T7DMFo8cqAo/\r\nHd0AVaSOLJgrURg/hry39AIz1wMNyojWKMtVndaTk6nzy+C/U02Q7vGoY2lZ\r\n02O/7+arXbIvD+OQAkDsSdXcN2zSELXXQlS+hhw4KgyLM1GyO1ldeTGuqadD\r\n8LmztL6En7cjIlRWajtUSBiN6jiiDaLXSY98s11Ke+UAstmzj0wqrlqFVvmF\r\nQ1OHWL0YKAVLVwVmil6kCsX25D7NQg5/93U+ekhdNwCt02EgXEBG/A8h8mig\r\nwiVYtNRWf82YcY1hvWFDt0jBfK86leFR3xab6NHzW5TO51ME9U4DEMYWIOTv\r\nFThyLDxehwGX/FouBFGfrLTy1DeD50y+xA5ppA7fQSISB9/ae4HXfh8Ty7Rx\r\npSbgo4fCqbW9FKQ3dSTqUnJN011DS5jz+BweAxXNz8X/AR9cmDZRMCH4a87Q\r\na/gQm7qJ/NUarDHkERaq/QFNq8KYLJeQxFk=\r\n=qJqV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHQGI1ues8L6dpI+uZkVU5uvAfd9CXd1Q2OZNMJzQ250AiBfQatc8YG5pjldE/ZFlE09Zp6f6doUx35tny9yCsSsyA=="}]},"_npmUser":{"name":"beladiyahardik7","email":"beladiyahardik7@gmail.com"},"maintainers":[{"name":"beladiyahardik7","email":"beladiyahardik7@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/http-status_1.5.2_1647240083821_0.537915176603061"},"_hasShrinkwrap":false}},"maintainers":[{"name":"beladiyahardik7","email":"beladiyahardik7@gmail.com"}],"description":"Interact with HTTP status code","homepage":"https://github.com/adaltas/node-http-status","keywords":["http","express","connect"],"repository":{"type":"git","url":"git+https://github.com/adaltas/node-http-status.git"},"contributors":[{"name":"David Worms","email":"david@adaltas.com"},{"name":"Daniel Gasienica","email":"daniel@gasienica.ch"}],"author":{"name":"David Worms","email":"david@adaltas.com","url":"https://www.adaltas.com"},"bugs":{"url":"http://github.com/adaltas/node-http-status/issues","email":"info@appinvento.io"},"license":"BSD-3-Clause","readme":"[![Build Status](https://secure.travis-ci.org/adaltas/node-http-status.png)](http://travis-ci.org/adaltas/node-http-status)\n\n# HTTP Status codes for Node\n\nUtility to interact with HTTP status codes.\n\n## Usage\n\nOnce you require this module, you may call it with either an HTTP code or a message name. With an HTTP code, you will get the message name while with a message name you will get an HTTP code.\n\n### HTTP Status Codes\nHTTP code names, messages, and classes are respectively accessible with the property `{code}_NAME`, `{code}_MESSAGE` and `{code}_CLASS`. This includes all statuses in the [IANA HTTP Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml), with the only addition being `418 I'm a teapot`.\n\nExtra status code are also made available that are not defined in the IANA registry, but used by popular software. They are grouped by category. Specific properties are exported by `http-status` under the property `extra` followed by the category name. Also, extra codes are merge with regular status codes and made available as modules available inside `http-status/lib/{category}`.\n\nAvailable categories are:\n\n<dl>\n  <dt><code>unofficial</code></dt>\n  <dd>This represent a list of codes which are not specified by any standard.</dd>\n  <dt><code>iis</code></dt>\n  <dd>Microsoft's Internet Information Services (IIS) web server expands the 4xx error class to signal errors with the client's request.</dd>\n  <dt><code>nginx</code></dt>\n  <dd>The NGINX web server software expands the 4xx error class to signal issues with the client's request.</dd>\n  <dt><code>cloudflare</code></dt>\n  <dd>Cloudflare's reverse proxy service expands the 5xx error class to signal issues with the origin server.</dd>\n</dl>\n\n### HTTP Status Code Classes\n\nIn addition to HTTP status codes, this module also contains status code classes under the `classes` property. Similar to HTTP codes, you can access class names and messages with the property `{class}_NAME` and `{class}_MESSAGE`\n\n## API\n\nThe API is structured as follows:\n\n```\n100\n100_NAME\n100_MESSAGE\n100_CLASS\nCONTINUE\n101\n101_NAME\n101_MESSAGE\n101_CLASS\nSWITCHING_PROTOCOLS\n…\nclasses.\n├── 1xx\n├── 1xx_NAME\n├── 1xx_MESSAGE\n├── INFORMATIONAL\n├── 2xx\n├── 2xx_NAME\n├── 2xx_MESSAGE\n├── SUCCESSFUL\n├── …\nextra.\n├── unofficial.\n│   ├── 103\n│   ├── 103_NAME\n│   ├── 103_MESSAGE\n│   ├── 103_CLASS\n│   ├── CHECKPOINT\n│   ├── …\n├── iis.\n│   ├── 440\n│   ├── 440_NAME\n│   ├── 440_MESSAGE\n│   ├── 440_CLASS\n│   ├── LOGIN_TIME_OUT\n│   ├── …\n├── nginx.\n│   ├── 444\n│   ├── 444_NAME\n│   ├── 444_MESSAGE\n│   ├── 444_CLASS\n│   ├── NO_RESPONSE\n│   ├── …\n├── cloudflare.\n│   ├── 520\n│   ├── 520_NAME\n│   ├── 520_MESSAGE\n│   ├── 520_CLASS\n│   ├── UNKNOWN_ERROR\n│   ├── …\n```\n\nFor additional information, please refer to [original code](./src/index.litcoffee).\n\n### Example Usage\n\n```javascript\nconst status = require('http-status');\n\nconsole.info(status.INTERNAL_SERVER_ERROR);\n// Output: 500\n\nconsole.info(status[500]);\nconsole.info(status[status.INTERNAL_SERVER_ERROR]);\n// Both output: \"Internal Server Error\"\n\nconsole.info(status['500_NAME']);\nconsole.info(status[`${status.INTERNAL_SERVER_ERROR}_NAME`]);\n// Both output: \"INTERNAL_SERVER_ERROR\"\n\nconsole.info(status['500_MESSAGE']);\nconsole.info(status[`${status.INTERNAL_SERVER_ERROR}_MESSAGE`]);\n// Both output: \"A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.\"\n\nconsole.info(status['500_CLASS']);\nconsole.info(status[`${status.INTERNAL_SERVER_ERROR}_CLASS`]);\n// Both output: \"5xx\"\n```\n\n### Example using `classes`\n\n```javascript\nconst status = require('http-status');\n\nconst responseCode = status.INTERNAL_SERVER_ERROR;\n\nswitch (status[`${responseCode}_CLASS`]) {\n  case status.classes.INFORMATIONAL:\n    // The responseCode is 1xx\n    break;\n  case status.classes.SUCCESSFUL:\n    // The responseCode is 2xx\n    break;\n  case status.classes.REDIRECTION:\n    // The responseCode is 3xx\n    break;\n  case status.classes.CLIENT_ERROR:\n    // The responseCode is 4xx\n    break;\n  case status.classes.SERVER_ERROR:\n    // The responseCode is 5xx\n    break;\n\n  default:\n    // Unknown\n    break;\n}\n```\n\n### Example Using `extra` Property\n\n```javascript\n// Accessing property from the NGINX category\nconst status = require('http-status');\nconsole.info(status.extra.nginx.NO_RESPONSE)\n// Accessing default HTTP status merged with NGINX status\nconst status = require('http-status/lib/nginx');\nconsole.info(status.IM_A_TEAPOT);\nconsole.info(status.NO_RESPONSE)\n```\n\n### Express Example\n\n```javascript\nconst express = require('express'),\n      redis   = require('redis'),\n      status  = require('http-status');\n// New Express HTTP server\nconst app = express.createServer();\n// Regster a route\napp.get('/', (req, res) => {\n  const client = redis.createClient();\n  client.ping((err, msg) => {\n    if (err) {\n      return res.send(status.INTERNAL_SERVER_ERROR);\n    }\n    res.send(msg, status.OK);\n  });\n});\n// Start the HTTP server\napp.listen(3000);\n```\n\n## Contributors\n\n- David Worms: <https://github.com/wdavidw>\n- Daniel Gasienica: <https://github.com/gasi>\n- Rodrigo: <rfsbraz@gmail.com>\n- Paul Vollmer: <paul.vollmer@fh-potsdam.de>\n- James Barcellano: <https://github.com/ckeboss>\n\nThis package is developed by [Adaltas](http://www.adaltas.com).\n","readmeFilename":"README.md"}