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

http-client-status

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-client-status

Inspect/Check HTTP status code

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

http-client-status Build Status

Inspect/Check HTTP status code.

Install

$ npm install --save http-client-status

Usage

Get text description of code.

// ES6
import { constants, codes, getStatusText } from 'http-client-status';

// or
var httpClientStatus = require('http-client-status');
var constants = httpClientStatus.constants,
    codes = httpClientStatus.codes,
    getStatusText = httpClientStatus.getStatusText;

console.log(codes[404]); 
//=> Not Found

console.log(codes[constants.NOT_FOUND]);
//=> Not Found

console.log(getStatusText(404)); 
//=> Not Found

console.log(getStatusText(constants.NOT_FOUND));
//=> Not Found

Check group.

// ES6
import {
  constants,
  is_informational,
  is_success,
  is_redirect,
  is_client_error,
  is_server_error
} from 'http-client-status';

// or
var httpClientStatus = require('http-client-status');
var constants = httpClientStatus.constants,
  is_informational = httpClientStatus.is_informational,
  is_success = httpClientStatus.is_success,
  is_redirect = httpClientStatus.is_redirect,
  is_client_error = httpClientStatus.is_client_error,
  is_server_error = httpClientStatus.is_server_error;

console.log(is_informational(101)); 
//=> true

console.log(is_informational(constants.SWITCHING_PROTOCOLS)); 
//=> true

console.log(is_success(200)); 
//=> true

console.log(is_success(constants.OK)); 
//=> true

console.log(is_redirect(301)); 
//=> true

console.log(is_redirect(constants.MOVED_PERMANENTLY)); 
//=> true

console.log(is_client_error(404)); 
//=> true

console.log(is_client_error(constants.NOT_FOUND)); 
//=> true

console.log(is_server_error(500)); 
//=> true

console.log(is_server_error(constants.INTERNAL_SERVER_ERROR)); 
//=> true

Credits

This package is strongly inspired by:

Keywords

FAQs

Package last updated on 24 Oct 2017

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