{"action":"created","issue":{"url":"https://api.github.com/repos/pgte/nock/issues/150","labels_url":"https://api.github.com/repos/pgte/nock/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/pgte/nock/issues/150/comments","events_url":"https://api.github.com/repos/pgte/nock/issues/150/events","html_url":"https://github.com/pgte/nock/issues/150","id":28259630,"number":150,"title":"Does not work with browserify","user":{"login":"jonprins","id":142877,"avatar_url":"https://avatars.githubusercontent.com/u/142877?v=3","gravatar_id":"","url":"https://api.github.com/users/jonprins","html_url":"https://github.com/jonprins","followers_url":"https://api.github.com/users/jonprins/followers","following_url":"https://api.github.com/users/jonprins/following{/other_user}","gists_url":"https://api.github.com/users/jonprins/gists{/gist_id}","starred_url":"https://api.github.com/users/jonprins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonprins/subscriptions","organizations_url":"https://api.github.com/users/jonprins/orgs","repos_url":"https://api.github.com/users/jonprins/repos","events_url":"https://api.github.com/users/jonprins/events{/privacy}","received_events_url":"https://api.github.com/users/jonprins/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pgte/nock/labels/bug","name":"bug","color":"e10c02"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":34,"created_at":"2014-02-25T16:13:22Z","updated_at":"2015-11-19T03:46:32Z","closed_at":"2015-11-13T11:56:06Z","body":"Nock expects http.ClientRequest to be defined; the http module that browserify supplies does not use this internal object. Since ClientRequest is an internal object not typically used in an application space, I'm filing this as a bug -- just because you're CommonJS, doesn't mean you're running on node :)\r\n\r\nThe error that exposes this issue:\r\n\r\n```\r\nPhantomJS 1.9.2 (Linux) ERROR\r\n        TypeError: 'undefined' is not an object (evaluating 'superCtor.prototype')\r\n        at /tmp/karma-browerify.js:1740\r\nPhantomJS 1.9.2 (Linux): Executed 0 of 0 ERROR (12.249 secs / 0 secs)\r\n```\r\n\r\nI've traced it down to line 161 of intercept.js. \r\n\r\nI understand if you consider nock to be just-for-node, and that extending nock to support mocking out browserify's http shim might be out of scope for the project. But it should probably be noted in the README.md that browserify is explicitly not supported (and, to be nice, suggest an alternative)."},"comment":{"url":"https://api.github.com/repos/pgte/nock/issues/comments/157942978","html_url":"https://github.com/pgte/nock/issues/150#issuecomment-157942978","issue_url":"https://api.github.com/repos/pgte/nock/issues/150","id":157942978,"user":{"login":"miazoom","id":15315956,"avatar_url":"https://avatars.githubusercontent.com/u/15315956?v=3","gravatar_id":"","url":"https://api.github.com/users/miazoom","html_url":"https://github.com/miazoom","followers_url":"https://api.github.com/users/miazoom/followers","following_url":"https://api.github.com/users/miazoom/following{/other_user}","gists_url":"https://api.github.com/users/miazoom/gists{/gist_id}","starred_url":"https://api.github.com/users/miazoom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miazoom/subscriptions","organizations_url":"https://api.github.com/users/miazoom/orgs","repos_url":"https://api.github.com/users/miazoom/repos","events_url":"https://api.github.com/users/miazoom/events{/privacy}","received_events_url":"https://api.github.com/users/miazoom/received_events","type":"User","site_admin":false},"created_at":"2015-11-19T03:46:32Z","updated_at":"2015-11-19T03:46:32Z","body":"Thank for reponding @ali322 , I've tried fetch-mock, fetchmock and reqwest, non of them works yet - I'll keep trying other modules :( \r\n\r\n@pgte I don't think it was because of the native fetch:  I've also tried something simpler: \r\n- created index.js with below content; \r\n- run \"node index.js n\"\r\n\r\n```javascript\r\nvar nock    = require('nock');\r\nvar fetch = require('isomorphic-fetch')\r\n\r\nnock('http://www.google.com')\r\n  .get('/')\r\n  .reply(499999999)\r\n  ;\r\n\r\nfetch('http://www.google.com/')\r\n.then( function(response) {console.log(response); });\r\n```\r\nnock was able to intercept the (isomorphic) fetch call and return me 499999999.\r\n\r\n"}}