mock request and response objects for smarter testing
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
README.md
package.json
server-request.js
server-response.js

README.md

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();