righttp is a lightweigt http client library which is intended to simplify http requests.
It is in a very early stage and patches, suggestions and ideas how to improve it are highly appreciated.
Currently there is only one way to perform a request:
request = Rig::HTTP.new( :host => "ruby-lang.org" )
response = request.send
request = Rig::HTTP.new(
:host => "ruby-lang.org",
:path => "/en/documentation/",
:params => {"love" => "true"}
:method => "GET",
:header => "x-CUSTOM-HEADER" => "Awesome"
)
response = request.send
There will be wrapper methods for the different HTTP methods in the future.
It is also possible to do multipart form POST/PUT requests with multiple
files attached.
request = Rig::HTTP.new(
:host => "example.org",
:path => "/posts",
:params => { "title" => "Oh Hai", "upload" => File.open("/path/to/file.jpg") }
)
response = request.send
The file will be closed once the multipart is created.
When a request is send it returns a Rig::HTTPResponse which has two attributes: header and body
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don’t break it in a
future version unintentionally. - Commit, do not mess with rakefile, version, or history.
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) - Send me a pull request. Bonus points for topic branches.
Copyright © 2010 hukl. See LICENSE for details.