A HTTP client library written from scratch, offering an easy interface with lots of flexibility
MIT License
h1. righttp
h2. What righttp wants to achieve
righttp is intended to provide a simple and clean interface for HTTP requests while allowing to override almost every parameter of the request if it is neccessary.
It is not just a wrapper of net/http
Its philosophy is to get out of your way.
Below you can see the various ways to make a request:
h2. Interface
bc.. HTTP.get( 'http://foobar.com' )
request = HTTP.get( 'http://foobar.com?foo=bar&baz=bang') response = request.send
response = HTTP.get( 'http://foobar.com:3000?foo=bar&baz=bang').send
request = HTTP.get( 'http://foobar.com', :body => {"foo" => "bar", :baz => "bang"} ) response = request.send
request = HTTP.get( 'http://foobar.com', :body => {"foo" => "bar", :baz => "bang"} ) response = request.send
request = HTTP.get( :host => 'foobar.com', :path => "/posts", :port => 3000 :body => {"foo" => "bar", :baz => "bang"}, ) response = request.send
request = HTTP.post( 'foobar.com', :body => {"foo" => "bar"} ) response = request.send
request = HTTP.post( 'foobar.com', :body => {"foo" => "bar", :attachment => File.open("path/to/file.jpg")} ) response = request.send
request = Rig::HTTP.new( :host => "example.org", :path => "/posts", :body => { "title" => "Oh Hai", "upload" => File.open("/path/to/file.jpg") } ) response = request.send
The file will be closed once the multipart is created.
h3. Responses
When a request is send it returns a Rig::HTTPResponse which has two attributes: status, header and body
h2. Note on Patches/Pull Requests
h2. Copyright
Copyright (c) 2010 hukl. See LICENSE for details.