flatiron/nock — pull request #50 by mattrobenolt (2012-03-16 17:13:32+00:00)
Title: Allow the response body to be a callback to construct dynamic responses based on the requestBody.

The only drawback I found with this is that there is no way to access the __original__ requestBody that was actually submitted. The fundamental problem with this is because all replies appear to be evaluated before an http request is actually made as opposed to being evaluated on demand.

For example:

```javascript
var nock = require('nock')
, http = require('http');

var scope = nock('http://www.google.com')
.filteringRequestBody(/.*/, '*')
.post('/echo', '*')
.reply(201, function(requestBody) {
return requestBody;
});

var req = http.request({
host: 'www.google.com'
, method: 'POST'
, path: '/echo'
, port: 80
}, function(res) {

res.on('end', function() {
scope.done();
});
res.on('data', function(data) {
console.log('requestBody:',data.toString());
});

});

req.write('key=val');
req.end();
```
requestBody is always `*`