Skip to content

Instantly share code, notes, and snippets.

@joepie91
Forked from mderijcke/stuff.js
Created January 3, 2015 18:00
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 joepie91/a36133c8daba6cec2464 to your computer and use it in GitHub Desktop.
Save joepie91/a36133c8daba6cec2464 to your computer and use it in GitHub Desktop.
function http_get(url, { "User-Agent" = "kitchen sink 2.0" }, { sayHi, verbose: v }) {
if (sayHi) {
console.log("HI!");
}
if (v) {
console.log("Sending request");
}
return require('http').get({
url,
headers: arguments[1]
});
}
http_get("http://icanhazip.com", { "Accept": "love, gzip", "User-Agent": "NotTheKitchenSink" }, { true, sayHi: false });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment