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

node-http-request-mock

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

node-http-request-mock

Very simple node.js module that allows you to mock http requests.

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

node-http-request-mock

Very simple node.js module that allows you to mock http requests.

require('node-http-request-mock');

var ops = {
  statusCode: 200,
  optionsAssertions : function(){
    console.log('initial assertions');
  },
  end: function(){
    console.log('this is the end');
  },
  write: function(){
    console.log('this is the write method');
  },
  autoRespond: true,
  responseData: '{"what":"ever"}'
};

var mock = new mockRequest(ops);

/*
*  Now do some testing ...
*/

// if the autoRespond is in false:
mock.respond();
// or
mock.fail();

// when you're done
mock.restore();

Keywords

node

FAQs

Package last updated on 29 Apr 2014

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