New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

is-http2

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-http2

Detect if a server support http/2

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

Build Status npm version npm downloads Coverage Status Uses greenkeeper.io

is-http2

Simple module to check if certain servers out there support HTTP/2.

install

$ npm install --save is-http2

Pre-requisites

To make is-http2 work, you need to have openssl in a version greater than 1.0.0 installed and available in your $path.

Basic usage

isHttp2( url, options )

Description : Check if server behind given url supports HTTP/2

url : Url to check HTTP/2 support for

Options

  • includeSpdy : optional: should SPDY be considered HTTP/2
  • openssl : optional: specify custom openssl command (i.e. '/usr/local/Cellar/openssl/1.0.2k/bin/openssl')

isHttp2 returns a Promise which will be resolved with an Object containing isHttp2 and supportedProtocols.

const isHttp2 = require( 'is-http2' );

isHttp2( 'twitter.com', { includeSpdy : true } )
  .then( function( result ) {
    if ( result.isHttp2 ) {
      console.log( `${ chalk.green( '✓' ) } HTTP/2 supported by ${ host }` );
    } else {
      console.log( `${ chalk.red( '×' ) } HTTP/2 not supported by ${ host }` );
    }

    if ( result.supportedProtocols ) {
      console.log(
        `Supported protocols: ${ result.supportedProtocols.join( ' ' ) }`
      );
    }
  } )
  .catch( function( error ) {
    console.error( chalk.red( error ) );

    process.exit( 1 );
  } );

I want to thank all these people for their great work!!!

Keywords

http/2

FAQs

Package last updated on 28 Dec 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