Sha256: dabb0609cdd6c3fdfa83e8911b7bcb662b79cb1b099886475eb2ee0bcaa5bee3
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 KB
Contents
require 'helper' requires_connection do requires_port(8080) do describe ZMachine::HttpRequest do # ssh -D 8080 igvita let(:proxy) { {:proxy => { :host => '127.0.0.1', :port => 8080, :type => :socks5 }} } it "should use SOCKS5 proxy" do ZMachine.run { http = ZMachine::HttpRequest.new('http://jsonip.com/', proxy).get http.errback { failed(http) } http.callback { http.response_header.status.should == 200 http.response.should match('173.230.151.99') ZMachine.stop } } end end end requires_port(8081) do describe ZMachine::HttpRequest do # brew install tinyproxy let(:http_proxy) { {:proxy => { :host => '127.0.0.1', :port => 8081 }} } it "should use HTTP proxy by default" do ZMachine.run { http = ZMachine::HttpRequest.new('http://jsonip.com/', http_proxy).get http.errback { failed(http) } http.callback { http.response_header.status.should == 200 http.response.should match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) ZMachine.stop } } end it "should auto CONNECT via HTTP proxy for HTTPS requests" do ZMachine.run { http = ZMachine::HttpRequest.new('https://ipjson.herokuapp.com/', http_proxy).get http.errback { failed(http) } http.callback { http.response_header.status.should == 200 http.response.should match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) ZMachine.stop } } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
z-http-request-0.2.0 | spec/socksify_proxy_spec.rb |
z-http-request-0.1.0 | spec/socksify_proxy_spec.rb |