Sha256: abc7cd8923ccb84fe81975d08cf0c47a8436ebc7ab20bcddbc2d807a1f188ab7
Contents?: true
Size: 1.56 KB
Versions: 6
Compression:
Stored size: 1.56 KB
Contents
require 'helper' describe EventMachine::HttpRequest do context "connections via" do let(:proxy) { {:proxy => { :host => '127.0.0.1', :port => 8083 }} } it "should use HTTP proxy" do EventMachine.run { http = EventMachine::HttpRequest.new('http://127.0.0.1:8090/?q=test', proxy).get http.errback { failed(http) } http.callback { http.response_header.status.should == 200 http.response.should match('test') EventMachine.stop } } end it "should send absolute URIs to the proxy server" do EventMachine.run { http = EventMachine::HttpRequest.new('http://127.0.0.1:8090/?q=test', proxy).get http.errback { failed(http) } http.callback { http.response_header.status.should == 200 # The test proxy server gives the requested uri back in this header http.response_header['X_THE_REQUESTED_URI'].should == 'http://127.0.0.1:8090/?q=test' http.response_header['X_THE_REQUESTED_URI'].should_not == '/?q=test' http.response.should match('test') EventMachine.stop } } end it "should include query parameters specified in the options" do EventMachine.run { http = EventMachine::HttpRequest.new('http://127.0.0.1:8090/', proxy).get :query => { 'q' => 'test' } http.errback { failed(http) } http.callback { http.response_header.status.should == 200 http.response.should match('test') EventMachine.stop } } end end end
Version data entries
6 entries across 6 versions & 1 rubygems