Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: b70e7e5191
Fetching contributors…

Cannot retrieve contributors at this time

23 lines (13 sloc) 0.839 kB


I always forget the API for Net:HTTP. This library wraps Net::HTTP and doesn't try to do anything too clever on top of that. PlainHTTP has 'get', 'post', 'put', and 'delete' methods. Call any of them with the full URL, followed by a hash of headers. In the case of 'post' and 'put' you can include a 3rd parameter which is the data to send along, it can be a string or a hash.

All of the calls return the built in Net:HTTPResponse objects.



response = PlainHTTP.get('')
puts response.body

POST with form params

response ='', {}, {:post_name => 'value'})
puts response.body

POST with string body

response ='', {}, '{"name":"Chris Cherry"}')
puts response.body
Jump to Line
Something went wrong with that request. Please try again.