Skip to content
Testing tool to create dummy responses to HTTP requests, modeled after:
Find file
Latest commit a596596 Dec 14, 2015 @ctide 0.0.21
Failed to load latest commit information.
test Enables regex matching on URIs, fixes #21. Dec 14, 2015
.gitignore ignore npm-debug.log Oct 18, 2011
LICENSE add a license Jul 30, 2013
fakeweb.js Enables regex matching on URIs, fixes #21. Dec 14, 2015
package.json 0.0.21 Dec 14, 2015

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:


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: '', body: 'Hello!'});
request.get({uri: ''}, output);

This will output:

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