Skip to content

Instantly share code, notes, and snippets.

@warpr
Created November 28, 2012 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save warpr/4163907 to your computer and use it in GitHub Desktop.
Save warpr/4163907 to your computer and use it in GitHub Desktop.
21:09 warp@bullet-bill:~/code/t$ node --version
v0.8.14
21:09 warp@bullet-bill:~/code/t$ npm install follow-redirects
npm http GET https://registry.npmjs.org/follow-redirects
npm http 200 https://registry.npmjs.org/follow-redirects
npm http GET https://registry.npmjs.org/follow-redirects/-/follow-redirects-0.0.2.tgz
npm http 200 https://registry.npmjs.org/follow-redirects/-/follow-redirects-0.0.2.tgz
npm http GET https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/underscore
follow-redirects@0.0.2 node_modules/follow-redirects
└── underscore@1.4.2
21:09 warp@bullet-bill:~/code/t$ cat ./reproduce.js
var http = require('follow-redirects').http;
// var http = require('http');
var options = {
headers: { 'Content-Length': 0 },
protocol: 'http:',
host: 'coverartarchive.org',
port: '',
method: 'GET',
path: '/release/cbd78c74-4281-4913-9c05-dfc48706df4e/',
maxRedirects: 4
};
var doRequest = http.request;
var req = doRequest(options, function (response) {
console.log('headers: ', JSON.stringify(response.headers));
console.log('status code: ', response.statusCode);
});
req.end ();
21:10 warp@bullet-bill:~/code/t$ node ./reproduce.js
/home/warp/code/t/node_modules/follow-redirects/index.js:62
var clientRequest = this.__proto__.request(options, redirectCallback(reqUr
^
TypeError: Object #<Object> has no method 'request'
at h.request (/home/warp/code/t/node_modules/follow-redirects/index.js:62:40)
at Object.<anonymous> (/home/warp/code/t/reproduce.js:17:11)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
21:10 warp@bullet-bill:~/code/t$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment