Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

24 lines (13 sloc) 0.653 kb

Mock Request/Response

Simple mock request and response objects to help with testing. Currently only server-side request and response mocks are supported.

server-request

Useful for testing http server code.

var mockrequest = require('mock-request-response/server-request');

var request = new mockrequest.request();
request.url = 'http//foo.com/bar.html?baz=boo&me=you';

server-response

Also useful for testing http server code.

var mockresponse = require('mock-request-response/server-response');

var response = new mockresponse.response();
response.write('this is a test');
response.end();
Jump to Line
Something went wrong with that request. Please try again.