nockstream

0.0.1 • Public • Published

Nockstream

A nock-compatible mockstream wrapper (for mocking HTTP requests).

Usage

Nockstream is designed for use with nock.

var Nockstream = require('nockstream'),
    nock = require('nock'),
    http = require('http');

var stream = new Nockstream({ streamString: 'Hello, world!' });
nock('http://github.com').get('/benastan').reply(200, stream);
http.get('https://github.com/benastan', function(res) {
  var str = '';
  res.on('data', function(chunk) { str += chunk.toString(); });
  res.on('end', function() { console.log(str); }); // Hello, world!
});

Readme

Keywords

none

Package Sidebar

Install

npm i nockstream

Weekly Downloads

1

Version

0.0.1

License

BSD

Last publish

Collaborators

  • benastan