pact-support 1.14.3 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '087dcf6851c39ea4ebd35e99b0ca22187881043cfdfd9066aec43f84e7b0312a'
4
- data.tar.gz: 0dbadb7e1f17f75c08380559800293bc1d150c96d86f757d28baf12a0db3151e
3
+ metadata.gz: f2ee65cf7dfde0e38da424b8c462877550c73d8eb4a32d141979e3571dd5b68b
4
+ data.tar.gz: 156429a88a8fa6e2af7650a4ab82541a375e81a7d7613f8c1fc35d21a0f0c18f
5
5
  SHA512:
6
- metadata.gz: 605bef579256f250e1f460558c1c70f5883ce3112aec69b41aa26128ba76d0f3fbebd7c6ca766c5d2552b22302d60c3c9b34a42d69ae6d642dde2db227b365fc
7
- data.tar.gz: 6d3876bbfa8f702790a4131c72fb092952297ee963e2a0e6cdd28d76de69ef6fdd6c11c55d18ef5cfc907fddc9fb972838f01a6f16d0700c93d920a7697e351b
6
+ metadata.gz: 3d14e51c30179bae9db88aa6b9dfc4c6780a9fb5aafd446e5e7b0914ccc1421f9d508a19d744864756b4a6b3809cc1579f0d344a169b1837f28ef6705f4b0448
7
+ data.tar.gz: 1e072929086a22a1e8a6ed2bc07e6a4d46fed8f666f177971596249357c641d1fc976c2751f73c03324963b81227bc0afa9324db905308cc8aabb4914c9d9b0a
@@ -1,3 +1,12 @@
1
+ <a name="v1.15.0"></a>
2
+ ### v1.15.0 (2020-04-30)
3
+
4
+
5
+ #### Bug Fixes
6
+
7
+ * follow first redirect when fetching remote pact artifacts. (#80) ([c1df6dd](/../../commit/c1df6dd))
8
+
9
+
1
10
  <a name="v1.14.3"></a>
2
11
  ### v1.14.3 (2020-04-06)
3
12
 
@@ -79,12 +79,37 @@ module Pact
79
79
 
80
80
  def get_remote(uri, options)
81
81
  request = Net::HTTP::Get.new(uri)
82
+ request = prepare_auth(request, options) if options[:username] || options[:token]
83
+
84
+ http = prepare_request(uri)
85
+ response = perform_http_request(http, request, options)
86
+
87
+ if response.is_a?(Net::HTTPRedirection)
88
+ uri = URI(response.header['location'])
89
+ req = Net::HTTP::Get.new(uri)
90
+ req = prepare_auth(req, options) if options[:username] || options[:token]
91
+
92
+ http = prepare_request(uri)
93
+ response = perform_http_request(http, req, options)
94
+ end
95
+ response
96
+ end
97
+
98
+ def prepare_auth(request, options)
82
99
  request.basic_auth(options[:username], options[:password]) if options[:username]
83
100
  request['Authorization'] = "Bearer #{options[:token]}" if options[:token]
101
+ request
102
+ end
103
+
104
+ def prepare_request(uri)
84
105
  http = Net::HTTP.new(uri.host, uri.port, :ENV)
85
106
  http.use_ssl = (uri.scheme == 'https')
86
107
  http.ca_file = ENV['SSL_CERT_FILE'] if ENV['SSL_CERT_FILE'] && ENV['SSL_CERT_FILE'] != ''
87
108
  http.ca_path = ENV['SSL_CERT_DIR'] if ENV['SSL_CERT_DIR'] && ENV['SSL_CERT_DIR'] != ''
109
+ http
110
+ end
111
+
112
+ def perform_http_request(http, request, options)
88
113
  http.start do |http|
89
114
  http.open_timeout = options[:open_timeout] || OPEN_TIMEOUT
90
115
  http.read_timeout = options[:read_timeout] || READ_TIMEOUT
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Support
3
- VERSION = "1.14.3"
3
+ VERSION = "1.15.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.3
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fraser
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-04-06 00:00:00.000000000 Z
15
+ date: 2020-05-01 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp
@@ -298,8 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
298
  - !ruby/object:Gem::Version
299
299
  version: '0'
300
300
  requirements: []
301
- rubyforge_project:
302
- rubygems_version: 2.7.6
301
+ rubygems_version: 3.0.6
303
302
  signing_key:
304
303
  specification_version: 4
305
304
  summary: Shared code for Pact gems