Skip to content

Commit

Permalink
feat: add http debug logging for create environment call
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jun 13, 2018
1 parent d6dbce8 commit 5f31fcb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/pact_broker/client/hal/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ module PactBroker
module Client
module Hal
class HttpClient
attr_accessor :username, :password
attr_reader :username, :password, :verbose

def initialize options
@username = options[:username]
@password = options[:password]
@verbose = options[:verbose]
end

def get href, params = {}, headers = {}
Expand Down Expand Up @@ -44,7 +45,9 @@ def create_request uri, http_method, body = nil, headers = {}
def perform_request request, uri
options = {:use_ssl => uri.scheme == 'https'}
response = Retry.until_true do
Net::HTTP.start(uri.host, uri.port, :ENV, options) do |http|
http = Net::HTTP.new(uri.host, uri.port, :ENV, options)
http.set_debug_output($stderr) if verbose
http.start do |http|
http.request request
end
end
Expand Down
3 changes: 1 addition & 2 deletions spec/lib/pact_broker/client/hal/http_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
module PactBroker::Client
module Hal
describe HttpClient do

before do
allow(Retry).to receive(:until_true) { |&block| block.call }
end

subject { HttpClient.new(username: 'foo', password: 'bar' ) }
subject { HttpClient.new(username: 'foo', password: 'bar') }

describe "get" do
let!(:request) do
Expand Down

0 comments on commit 5f31fcb

Please sign in to comment.