Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

status-codes

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

status-codes

Return HTTP Status Codes with name and message

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-81.82%
Maintainers
1
Weekly downloads
 
Created
Source

status-codes

NPM Version NPM Downloads

Small module to return all known HTTP status with a name and brief description.

Installation

$ npm install status-codes --save

Using

All codes from this Wiki HTTP Status Codes

    
    var statusCodes = require('status-codes');

	statusCodes[404];
		
	/** 
	
	Returns:
	
	{
		"status": 404,
		"name": "Not Found",
		"message": "The server has not found anything matching the Request-URI."
	}
	
	**/
	
	// OR use a get method that has a fallback to a code 400 if it doesn't find a valid code
	
	statusCodes.get(536727);
	
	/** 
	
	Returns:
	
	{
		"status": 400,
		"name": "Bad Request",
		"message": "The server cannot or will not process the request."
	}
	
	**/

Constants

Can retrive HTTP status by name too:


	statusCodes.NOT_FOUND;
		
	/** 
	
	Returns:
	
	{
		"status": 404,
		"name": "Not Found",
		"message": "The server has not found anything matching the Request-URI."
	}
	
	**/

Keywords

FAQs

Package last updated on 26 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc