Skip to content
This repository

this is not a HTTP request lib like the ones you see around, it is REAL BROWSAH!

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 docs
Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 script
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 browsah.gemspec
README.md

It's a REAL BROWSAH!!!1!

Build Status

Unlike other HTTP client libraries, browsah aims to be a true browser.

fair warning: Since browsah depends on em-http-request and em-synchrony, thus is Ruby 1.9.x only.

Examples

For more examples, see examples.

Simple POST/GET:

require 'browsah'
require 'json'

headers = { 'Content-Type' => 'application/json' }
body    = { "longUrl" => "http://engineering.abril.com.br" }.to_json
bw      = Browsah.new('https://www.googleapis.com')

bw.post '/urlshortener/v1/url', :body => body, :headers => headers do |r|
  r.on(200) do
    parsed = JSON.parse(r.body)
    jj parsed
  end
end

bw.get '/urlshortener/v1/url?shortUrl=http://goo.gl/TT1LT' do |r|
  r.on(200) do
    parsed = JSON.parse(r.body)
    jj parsed
  end
end

License

MIT License. Copyright (c) 2011 Abril Midia.

See LICENSE for details.

Something went wrong with that request. Please try again.