Skip to content

Instantly share code, notes, and snippets.

@stubbetje
Created January 29, 2014 17:28
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 stubbetje/8692794 to your computer and use it in GitHub Desktop.
Save stubbetje/8692794 to your computer and use it in GitHub Desktop.
request = (body,callback) ->
alert( body.toSource() )
class Robot
http: (url) ->
httpClient = {}
methods = [ 'get', 'post', 'put', 'del', 'head' ]
methods.forEach (method) ->
httpClient[ method ] = (body,callback) ->
request( {
url: url,
method: method,
}, callback )
httpClient
r = new Robot
r.http( "http://www.google.be" ).get()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment