Skip to content

Instantly share code, notes, and snippets.

@indexzero
Created June 22, 2011 00:25
Show Gist options
  • Save indexzero/1039272 to your computer and use it in GitHub Desktop.
Save indexzero/1039272 to your computer and use it in GitHub Desktop.
A quick and dirty example of some APIs that could go into a "mock-request" library
var mockRequest = require('mock-request');
console.dir(mockRequest
.get('/auth').responds(200)
.get('/apps/mickey').responds(200, { /* some JSON */ }));
// [
// {
// request: {
// //
// // Include more defaults here
// //
// path: '/auth'
// },
// response: {
// //
// // Include more defaults here
// //
// statusCode: 200
// }
// }
// ...
// ...plus data for `.get('/apps/mickey').responds(200, { /* some JSON */ })
// ...
// ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment