Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (22 sloc) 635 Bytes

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.js
Jump to Line
Something went wrong with that request. Please try again.