how can superagent and nock work together?
问题 In node.js, I have trouble making superagent and nock work together. If I use request instead of superagent, it works perfectly. Here is a simple example where superagent fails to report the mocked data: var agent = require('superagent'); var nock = require('nock'); nock('http://thefabric.com') .get('/testapi.html') .reply(200, {yes: 'it works !'}); agent .get('http://thefabric.com/testapi.html') .end(function(res){ console.log(res.text); }); the res object has no 'text' property. Something