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

http-status

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-status

Interact with HTTP status code

  • 1.8.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
536K
increased by1.09%
Maintainers
0
Weekly downloads
 
Created

What is http-status?

The http-status npm package provides a collection of HTTP status codes and their associated messages. It is useful for setting and interpreting HTTP response statuses in web applications.

What are http-status's main functionalities?

Accessing Status Codes

You can easily access standard HTTP status codes using the package. This is useful for setting response statuses in your web server.

const httpStatus = require('http-status');
console.log(httpStatus.OK); // 200
console.log(httpStatus.NOT_FOUND); // 404

Accessing Status Messages

The package allows you to retrieve the standard message associated with a given status code. This can be useful for logging or displaying human-readable status messages.

const httpStatus = require('http-status');
console.log(httpStatus['200']); // 'OK'
console.log(httpStatus['404']); // 'Not Found'

Custom Status Codes

You can add custom status codes and messages to the http-status object. This is useful if your application uses non-standard status codes.

const httpStatus = require('http-status');
httpStatus['999'] = 'Custom Status';
console.log(httpStatus['999']); // 'Custom Status'

Other packages similar to http-status

Keywords

FAQs

Package last updated on 21 Oct 2024

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