unexpected-mitm
Plugin for Unexpected that allows you to mock out http(s) traffic via mitm, but using a declarative syntax.
var expect = require('unexpected')
.installPlugin(require('unexpected-mitm'))
.installPlugin(require('unexpected-http'));
it('should GET a mocked response', function () {
return expect('http://www.google.com/', 'with http mocked out', {
request: 'GET /',
response: {
statusCode: 200,
headers: {
'Content-Type': 'text/plain'
},
body: 'Hey there!'
}
}, 'to yield response', {
body: 'Hey there!'
});
});
License
Unexpected-mitm is licensed under a standard 3-clause BSD license -- see the LICENSE
file for details.