Skip to content
Tony Arcieri edited this page Feb 14, 2016 · 10 revisions

Making POST requests is simple too. Want to POST a form?

HTTP.post("http://example.com/resource", :form => {:foo => "42"})

Making GET requests with query string parameters is as simple.

HTTP.get("http://example.com/resource", :params => {:foo => "bar"})

Want to POST with a specific body, JSON for instance?

HTTP.post("http://example.com/resource", :json => { :foo => "42" })

Or just a plain body?

HTTP.post("http://example.com/resource", :body => "foo=42&bar=baz")

Posting a file?

HTTP.post("http://examplc.com/resource", :form => {
  :username => "ixti",
  :avatar   => HTTP::FormData::File.new("/home/ixit/avatar.png")
})

It's easy!