2.0.1 • Published 4 years ago

statuses v2.0.1

Weekly downloads
21,785,521
License
MIT
Repository
github
Last release
4 years ago

statuses

NPM Version NPM Downloads Node.js Version Build Status Test Coverage

HTTP status utility for node.

This module provides a list of status codes and messages sourced from a few different projects:

Installation

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ npm install statuses

API

var status = require('statuses')

status(code)

Returns the status message string for a known HTTP status code. The code may be a number or a string. An error is thrown for an unknown status code.

status(403) // => 'Forbidden'
status('403') // => 'Forbidden'
status(306) // throws

status(msg)

Returns the numeric status code for a known HTTP status message. The message is case-insensitive. An error is thrown for an unknown status message.

status('forbidden') // => 403
status('Forbidden') // => 403
status('foo') // throws

status.codes

Returns an array of all the status codes as Integers.

status.codemsg

Returns the numeric status code for a known status message (in lower-case), otherwise undefined.

status['not found'] // => 404

status.emptycode

Returns true if a status code expects an empty body.

status.empty[200] // => undefined
status.empty[204] // => true
status.empty[304] // => true

status.messagecode

Returns the string message for a known numeric status code, otherwise undefined. This object is the same format as the Node.js http module http.STATUS_CODES.

status.message[404] // => 'Not Found'

status.redirectcode

Returns true if a status code is a valid redirect status.

status.redirect[200] // => undefined
status.redirect[301] // => true

status.retrycode

Returns true if you should retry the rest.

status.retry[501] // => undefined
status.retry[503] // => true

License

MIT

http-errorssendfinalhandlerexpress@switchsystems/aws-lambda-node-apiresponse@teakit/atomcomponennentteasy-select-rn@sotaoi/oauth2-expresschinjowwchinjowvuedragdropuploadimagesreact-native-bluetooth2killi8n-react-native-fast-imageextensible-node-serverrn-send-sms@arisageha/react-lazyload@arisageha/react-lazyload-fixsfr-koa@hgc-ab/oauth-services@eaze/signup@vulcan/errorsreact-native-template-rfbasesmartif-oauth2-serverairscanairscan-examplebb-chatreact-native-esc-pos-sahaab@borisovart/atol-kkt-module@wgytcraft/express@frxf/frxf@hgc-ab/oauth-servicedeneme323112@texttree/demo-bsa-reference-rcl@sotaoi/oauth2@kravc/common-service@ntt_app/react-native-custom-notificationwebflow-reactreact-native-custom-text-hwjames@easyboot/core@oknesar/expressreact-native-covid-sdkanime-random@foldsh/sdkeni-chatoauth2-server2react-native-thanh-toast-librarypmswebserve@thanhnguyen14797/react-native-thanh-toast-library@l1nyanm1ng/react-picture-viewercthpb-plugin-socialkoali@signalchain/expressexpress-easy-static@subosito/oauth2-serverreact-native-printer-brothersrn-pdf-reader-offlinenahan-context-koanode-netteasim-mockersreact-native-shekhar-bridge-testcogoportutilssoi.tekcodai-staticlevibestliblevibestlib2levilibtest19levilibtest24levilibtest25levilibtest26levilibtest27levilibtest28levilibtest29servidorwilscanner@oiti/documentoscopy-react-nativequoc-testreact-native-slider-kfnodejs-fileshareunblock-block-save-variableshexa-node-common@infinitebrahmanuniverse/nolb-statucclibyarntest@saaspe/components@minisode/mosh@minisode/threddedhyperpass-sdkthing-it-serverexpress-api-pack-tropea-bootstraapluminos-ui-corelizeknushiliyahaotadiesklif-ui-kitsklif-api@everything-registry/sub-chunk-2823jawwy-sdkjawwy_gamification_releasereact-native-sphereui@cryptoaddicteds/acn-express-rest-interfacesphereui
2.0.1

4 years ago

2.0.0

5 years ago

1.5.0

7 years ago

1.4.0

8 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.1

10 years ago

1.2.0

11 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.4

11 years ago

1.0.3

11 years ago

1.0.2

11 years ago

1.0.1

11 years ago