Skip to content

Instantly share code, notes, and snippets.

@sreepurnajasti
Created June 29, 2018 08:03
Show Gist options
  • Save sreepurnajasti/dae190c3d95009c3ccd93fb10fbdfcf7 to your computer and use it in GitHub Desktop.
Save sreepurnajasti/dae190c3d95009c3ccd93fb10fbdfcf7 to your computer and use it in GitHub Desktop.
Using request module with proxy
var request = require('request');
var r = request.defaults({'proxy':'http://192.168.1.1:3128'});
r('http://www.google.com', function (error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body); // Print the HTML for the Google homepage.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment