Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Testing tool to create dummy responses to HTTP requests, modeled after: https://github.com/chrisk/fakeweb

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 fakeweb.js
Octocat-spinner-32 package.json
README.md

Node Fakeweb

A simple tool that will intercept requests made via http.request and mikeal's request module and respond with dummy data.

Heavily inspired by: https://github.com/chrisk/fakeweb

Installation

npm install node-fakeweb

Basic Examples

var request = require('request');
var fakeweb = require('node-fakeweb');
var output = function(err, resp, body) { console.log(body); }

fakeweb.allowNetConnect = false;
fakeweb.registerUri({uri: 'http://www.testing.com:80/', body: 'Hello!'});
request.get({uri: 'http://www.testing.com:80/'}, output);

This will output:

[ctide ~]:~$ node test.js
Hello!
Something went wrong with that request. Please try again.