Add http proxy support #24

Merged
merged 1 commit into from Feb 20, 2013

2 participants

@whatthewhat

Hello, thanks for supporting this useful gem!

This pull request adds http proxy support with this configs:

ga = Gattica.new({ 
    ...
    :http_proxy => { :host => 'proxy.example.com', :port => 8080, :user => 'username', :password => 'password' }
})

I've tried to add some tests around this feature, i.e. something like:

def test_setting_http_proxy
  ga = Gattica.new((GatticaTest::DEFAULT_AUTH).merge!(:http_proxy => { host: "proxy.example.com", port: "8080", user: "user", password: "password" }))
  http = ga.instance_variable_get('@http')
  assert http.proxy_host == "proxy.example.com", "proxy_host should be 'proxy.example.com'"
  assert http.proxy_port == "8080", "proxy_port should be '8080'"
  assert http.proxy_user == "user", "proxy_user should be 'user'"
  assert http.proxy_pass == "password", "proxy_user should be 'password'"
end

but since Gattica.new starts real http connection this approach didn't really work out.. so I left out the tests for now, but the code is very simple and i've tested it manually in couple environments.

Mikhail Topolskiy Add http proxy support 42d3c9c
@chrisle chrisle merged commit bb99363 into chrisle:master Feb 20, 2013
@chrisle
Owner

Thank you!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment