{"action":"created","issue":{"url":"https://api.github.com/repos/node-nock/nock/issues/596","repository_url":"https://api.github.com/repos/node-nock/nock","labels_url":"https://api.github.com/repos/node-nock/nock/issues/596/labels{/name}","comments_url":"https://api.github.com/repos/node-nock/nock/issues/596/comments","events_url":"https://api.github.com/repos/node-nock/nock/issues/596/events","html_url":"https://github.com/node-nock/nock/issues/596","id":161740490,"number":596,"title":"Nocked calls to nested HTTP calls not working as expected","user":{"login":"maheshjag","id":1705603,"avatar_url":"https://avatars.githubusercontent.com/u/1705603?v=3","gravatar_id":"","url":"https://api.github.com/users/maheshjag","html_url":"https://github.com/maheshjag","followers_url":"https://api.github.com/users/maheshjag/followers","following_url":"https://api.github.com/users/maheshjag/following{/other_user}","gists_url":"https://api.github.com/users/maheshjag/gists{/gist_id}","starred_url":"https://api.github.com/users/maheshjag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maheshjag/subscriptions","organizations_url":"https://api.github.com/users/maheshjag/orgs","repos_url":"https://api.github.com/users/maheshjag/repos","events_url":"https://api.github.com/users/maheshjag/events{/privacy}","received_events_url":"https://api.github.com/users/maheshjag/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-06-22T17:27:07Z","updated_at":"2016-08-03T16:12:48Z","closed_at":null,"body":"Here's a sample app:\r\n\r\n\tvar express = require('express');\r\n\tvar cookieParser = require('cookie-parser');\r\n\tvar bodyParser = require('body-parser');\r\n\tvar request = require('request');\r\n\r\n\tvar app = express();\r\n\tvar PORT = 1234;\r\n\tapp.set('port', PORT);\r\n\tapp.use(bodyParser.json());\r\n\tapp.use(bodyParser.urlencoded({ extended: false }));\r\n\tapp.use(cookieParser());\r\n\r\n\tapp.get('/test', function (req, res) {\r\n\t    request.get('http://www.google.com', function (err, response, body) {\r\n\t        res.send(body);\r\n\t    });\r\n\t});\r\n\r\n\tapp.listen(PORT, function () {\r\n\t    console.log('App started on port ' + PORT + '!');\r\n\t});\r\n\r\n\r\nHere's the Mocha test for it:\r\n\r\n\tvar mocker = require('nock');\r\n\tvar assert = require('chai').assert;\r\n\tvar request = require('request');\r\n\r\n\tdescribe('node-nock', function () {\r\n\t    var testOutput = 'Hooray!';\r\n\t    mocker('http://www.google.com')\r\n\t        .get('/')\r\n\t        .reply(200, testOutput);\r\n\r\n\t    it('should mock the request to google.com', function (done) {\r\n\t        request('http://localhost:1234/test', function (err, response, body) {\r\n\t            assert.equal(testOutput, body);\r\n\t            done();\r\n\t        });\r\n\t    });\r\n\t});\r\n\r\nRunning the test above fails the assertion even though the call to www.google.com has been nocked."},"comment":{"url":"https://api.github.com/repos/node-nock/nock/issues/comments/237285477","html_url":"https://github.com/node-nock/nock/issues/596#issuecomment-237285477","issue_url":"https://api.github.com/repos/node-nock/nock/issues/596","id":237285477,"user":{"login":"matanh-tzmedical","id":11762657,"avatar_url":"https://avatars.githubusercontent.com/u/11762657?v=3","gravatar_id":"","url":"https://api.github.com/users/matanh-tzmedical","html_url":"https://github.com/matanh-tzmedical","followers_url":"https://api.github.com/users/matanh-tzmedical/followers","following_url":"https://api.github.com/users/matanh-tzmedical/following{/other_user}","gists_url":"https://api.github.com/users/matanh-tzmedical/gists{/gist_id}","starred_url":"https://api.github.com/users/matanh-tzmedical/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matanh-tzmedical/subscriptions","organizations_url":"https://api.github.com/users/matanh-tzmedical/orgs","repos_url":"https://api.github.com/users/matanh-tzmedical/repos","events_url":"https://api.github.com/users/matanh-tzmedical/events{/privacy}","received_events_url":"https://api.github.com/users/matanh-tzmedical/received_events","type":"User","site_admin":false},"created_at":"2016-08-03T16:12:48Z","updated_at":"2016-08-03T16:12:48Z","body":"@vitorarins I've only used Nock a little bit, but there are a couple things you can try to help you pinpoint the problem. Look at the `.isDone()` function (https://github.com/node-nock/nock#isdone) and the `.pendingMocks()` function (https://github.com/node-nock/nock#pendingmocks). These might help you figure out what's going on."}}
{"actor":{"display_login":"matanh-tzmedical"}}