Skip to content

Commit

Permalink
Fixup cops for proxy change
Browse files Browse the repository at this point in the history
  • Loading branch information
voxxit committed Aug 13, 2021
1 parent bfa6b8f commit 2fa61d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions lib/opensrs/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ def signature(request)
end

def http
if @proxy
http = Net::HTTP.new(server.host, server.port, @proxy.host, @proxy.port, @proxy.user, @proxy.password)
else
http = Net::HTTP.new(server.host, server.port)
end
http = if @proxy
Net::HTTP.new(server.host, server.port, @proxy.host, @proxy.port, @proxy.user, @proxy.password)
else
Net::HTTP.new(server.host, server.port)
end

http.use_ssl = (server.scheme == "https")
http.use_ssl = (server.scheme == 'https')
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.read_timeout = http.open_timeout = @timeout if @timeout
http.open_timeout = @open_timeout if @open_timeout
Expand Down
8 changes: 4 additions & 4 deletions spec/opensrs/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
end

it 'allows a proxy to be set during initialization' do
proxy = "http://user:[email protected]:1234"
server = OpenSRS::Server.new({ :proxy => proxy })
proxy = 'http://user:[email protected]:1234'
server = described_class.new({ proxy: proxy })

expect(server.proxy).to be_a(URI)
end
Expand Down Expand Up @@ -116,12 +116,12 @@
end

it 'allows setting a proxy' do
proxy = URI("http://user:[email protected]:1234")
proxy = URI('http://user:[email protected]:1234')
server.proxy = proxy

Net::HTTP.should_receive(:new).with(anything, anything, proxy.host, proxy.port, proxy.user, proxy.password)

server.call( { :some => 'data' } )
server.call({ some: 'data' })
end

it 're-raises Net:HTTP timeouts' do
Expand Down

0 comments on commit 2fa61d5

Please sign in to comment.