Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A HTTP client library written from scratch, offering an easy interface with lots of flexibility
Ruby
tree: 4914451cf9

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
doc
lib
test
.document
.gitignore
LICENSE
README.textile
Rakefile
VERSION
righttp.gemspec

README.textile

righttp

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.

Usage

Currently there is only one way to perform a request:

Minimal version

request  = Rig::HTTP.new( :host => "ruby-lang.org" )
response = request.send

More elaborate version

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.

Multipart Post

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.

Responses

When a request is send it returns a Rig::HTTPResponse which has two attributes: header and body

Note on Patches/Pull Requests

  • 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

Copyright © 2010 hukl. See LICENSE for details.

Something went wrong with that request. Please try again.