Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect the global :proxy setting for WSDL requests, too. #378

Merged
merged 2 commits into from
Jan 26, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/savon/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def initialize(globals, http_request = nil)
end

def build
configure_request
configure_timeouts
configure_ssl

Expand All @@ -17,6 +18,10 @@ def build

private

def configure_request
@http_request.proxy = @globals[:proxy] if @globals.include? :proxy
end

def configure_timeouts
@http_request.open_timeout = @globals[:open_timeout] if @globals.include? :open_timeout
@http_request.read_timeout = @globals[:read_timeout] if @globals.include? :read_timeout
Expand Down
14 changes: 14 additions & 0 deletions spec/savon/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ def new_wsdl_request
expect(wsdl_request.build).to be_an(HTTPI::Request)
end

describe "proxy" do
it "is set when specified" do
globals.proxy("http://proxy.example.com")
http_request.expects(:proxy=).with("http://proxy.example.com")

new_wsdl_request.build
end

it "is not set otherwise" do
http_request.expects(:proxy=).never
new_wsdl_request.build
end
end

describe "open timeout" do
it "is set when specified" do
globals.open_timeout(22)
Expand Down