Skip to content

Instantly share code, notes, and snippets.

@maxp
Created June 20, 2013 13:31
Show Gist options
  • Select an option

  • Save maxp/5822696 to your computer and use it in GitHub Desktop.

Select an option

Save maxp/5822696 to your computer and use it in GitHub Desktop.
fetch_url = (st, param, cb) ->
request {
url: param.url
pool: false
timeout: (param.timeout ? config_def.timeout) * 1000
},
(err, resp, body) ->
if err or resp.statusCode != 200
warn "fetch_url() failed:", param.url, err
else
try
cb(st, param, body)
catch e
warn "fetch_url()", st, e
#-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment