Skip to content

Instantly share code, notes, and snippets.

@geertbrit
Created January 13, 2018 17:17
Show Gist options
  • Select an option

  • Save geertbrit/57689768eceaec43ae0ddd17949d7503 to your computer and use it in GitHub Desktop.

Select an option

Save geertbrit/57689768eceaec43ae0ddd17949d7503 to your computer and use it in GitHub Desktop.
x-ray driver extended with proxy
var Request = require('request')
var r = request.defaults({'proxy':'http://localproxy.com'})
function makeDriver(opts) {
if (typeof opts === "function") {
var request = opts
} else {
var request = Request.defaults(opts)
}
return function driver(context, callback) {
var url = context.url
request(url, function(err, response, body) {
return callback(err, body)
})
}
}
module.exports = makeDriver
@geertbrit
Copy link
Copy Markdown
Author

You call the above driver as specified here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment