🚀 Launch Week Day 2:Introducing Custom Tabs for Org Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

http2spy

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http2spy

test helpers for working with Node.js' http2 module

latest
Source
npmnpm
Version
2.0.2
Version published
Maintainers
2
Created
Source

http2spy

Build Status nycrc config on GitHub Conventional Commits

Spy on nodejs' built-in http2 module and assert against requests that have been performed:

const assert = require("assert");
const http2spy = require("http2spy");
const myClient = http2spy.require(require.resolve("./lib/my-client"));

// do something with your http2 API client, e.g.,
// client.request({ ":method": "GET", ":path": "/" });

// now examine the requests:
assert.strictEqual(http2spy.requests[0][":method"], 'GET');

Passing Additional Stubs

http2spy is just a thin wrapper on top of proxyquire, if you would like to pass additional libraries to stub, simply provide them as a second parameter:

const myClient = http2spy.require(require.resolve("./lib/my-client"), {
  'second-library': {
    foo: () => {}
  }
});

License

Apache Version 2.0

Keywords

http2

FAQs

Package last updated on 13 Jul 2020

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