lib/pact/provider/pact_source.rb in pact-1.43.0 vs lib/pact/provider/pact_source.rb in pact-1.43.1
- old
+ new
@@ -1,6 +1,8 @@
require 'pact/consumer_contract/pact_file'
+require 'pact/hal/http_client'
+require 'pact/hal/entity'
module Pact
module Provider
class PactSource
@@ -14,9 +16,16 @@
@pact_json ||= Pact::PactFile.read(uri.uri, uri.options)
end
def pact_hash
@pact_hash ||= JSON.load(pact_json, nil, { max_nesting: 50 })
+ end
+
+ def hal_entity
+ http_client_keys = [:username, :password, :token]
+ http_client_options = uri.options.reject{ |k, _| !http_client_keys.include?(k) }
+ http_client = Pact::Hal::HttpClient.new(http_client_options.merge(verbose: true))
+ Pact::Hal::Entity.new(uri, pact_hash, http_client)
end
end
end
end