Sha256: 51c37b965b9d61736e049a2e60fed3d5d15f757917cca550f4230b10b0e48a86
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper')) Shindo.tests('Excon proxy support') do tests('proxy configuration') do tests('no proxy') do connection = Excon.new('http://foo.com') tests('connection.proxy').returns(nil) do connection.proxy end end tests('with fully-specified proxy: https://myproxy.net:8080') do connection = Excon.new('http://foo.com', :proxy => 'https://myproxy.net:8080') tests('connection.proxy.host').returns('myproxy.net') do connection.proxy[:host] end tests('connection.proxy.port').returns(8080) do connection.proxy[:port] end tests('connection.proxy.scheme').returns('https') do connection.proxy[:scheme] end end end with_rackup('proxy.ru') do tests('http proxying: http://foo.com:8080') do connection = Excon.new('http://foo.com:8080', :proxy => 'http://localhost:9292') response = connection.request(:method => :get, :path => '/bar', :query => {:alpha => 'kappa'}) tests('response.status').returns(200) do response.status end # must be absolute form for proxy requests tests('sent Request URI').returns('http://foo.com:8080/bar?alpha=kappa') do response.headers['Sent-Request-Uri'] end tests('sent Host header').returns('foo.com:8080') do response.headers['Sent-Host'] end tests('sent Proxy-Connection header').returns('Keep-Alive') do response.headers['Sent-Proxy-Connection'] end tests('response.body (proxied content)').returns('proxied content') do response.body end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
excon-0.6.0 | tests/proxy_tests.rb |