pact-support 1.16.7 → 1.16.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b1de8b63cb135275a86faed84d5d19801511635776af1df35a3623404ada402
4
- data.tar.gz: e0b91f3241c8182a388cf797243386e8880378e52dd4d92ae4c65d933e17b1b5
3
+ metadata.gz: 03a46a4e6bb3335f9acc353c80f485bd22d92e6b137e85fd25559a141eb282da
4
+ data.tar.gz: 967af721b125b04d725e5743a6759c6215b3b2af5e99526b9bbcfdf019ae0f05
5
5
  SHA512:
6
- metadata.gz: 27276869572d6aec5d75a761b29ac5689ebf52bcfca16741fae40ba0430466cecba0f3281d1f537aad09026c6f60af6289772e143f1581a73b45b47c8492e1b1
7
- data.tar.gz: 87be707868c70b0dc2136e476721e8ccd575529a48d5e4092bf55886a18c7bc2d424036d86e50c317b5ccb2b591bbcd9d8394cd4dc0da1844ce2069a5d8c379f
6
+ metadata.gz: ee9efbb1051d9064ffe0079711885e56b90c14e01868d8afbb5a9b08bd85ca42f89226f805a61c44f6d565ba61157250b36dbc742722bb859af2789de21b0292
7
+ data.tar.gz: bff0e437c5392f0ead03eba3d0932ac71eea1a1fd44f6add3f68a3df023092bca101a465fc16c13f633efb9f1eb19c336705161d67aaac9dfff116b191fe5546
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ <a name="v1.16.8"></a>
2
+ ### v1.16.8 (2021-07-27)
3
+
4
+ #### Bug Fixes
5
+
6
+ * log HTTP request for pacts retrieved by URL when requested with verbose=true ([3288b81](/../../commit/3288b81))
7
+
1
8
  <a name="v1.16.7"></a>
2
9
  ### v1.16.7 (2021-01-28)
3
10
 
@@ -1,4 +1,6 @@
1
- require 'net/http'
1
+ require "net/http"
2
+ require "pact/configuration"
3
+ require "pact/http/authorization_header_redactor"
2
4
 
3
5
  module Pact
4
6
  module PactFile
@@ -81,7 +83,7 @@ module Pact
81
83
  request = Net::HTTP::Get.new(uri)
82
84
  request = prepare_auth(request, options) if options[:username] || options[:token]
83
85
 
84
- http = prepare_request(uri)
86
+ http = prepare_request(uri, options)
85
87
  response = perform_http_request(http, request, options)
86
88
 
87
89
  if response.is_a?(Net::HTTPRedirection)
@@ -89,7 +91,7 @@ module Pact
89
91
  req = Net::HTTP::Get.new(uri)
90
92
  req = prepare_auth(req, options) if options[:username] || options[:token]
91
93
 
92
- http = prepare_request(uri)
94
+ http = prepare_request(uri, options)
93
95
  response = perform_http_request(http, req, options)
94
96
  end
95
97
  response
@@ -101,11 +103,12 @@ module Pact
101
103
  request
102
104
  end
103
105
 
104
- def prepare_request(uri)
106
+ def prepare_request(uri, options)
105
107
  http = Net::HTTP.new(uri.host, uri.port, :ENV)
106
108
  http.use_ssl = (uri.scheme == 'https')
107
109
  http.ca_file = ENV['SSL_CERT_FILE'] if ENV['SSL_CERT_FILE'] && ENV['SSL_CERT_FILE'] != ''
108
110
  http.ca_path = ENV['SSL_CERT_DIR'] if ENV['SSL_CERT_DIR'] && ENV['SSL_CERT_DIR'] != ''
111
+ http.set_debug_output(Pact::Http::AuthorizationHeaderRedactor.new(Pact.configuration.output_stream)) if options[:verbose]
109
112
  http
110
113
  end
111
114
 
@@ -0,0 +1,32 @@
1
+ require "delegate"
2
+
3
+ module Pact
4
+ module Http
5
+ class AuthorizationHeaderRedactor < SimpleDelegator
6
+ def puts(*args)
7
+ __getobj__().puts(*redact_args(args))
8
+ end
9
+
10
+ def print(*args)
11
+ __getobj__().puts(*redact_args(args))
12
+ end
13
+
14
+ def <<(*args)
15
+ __getobj__().send(:<<, *redact_args(args))
16
+ end
17
+
18
+ private
19
+
20
+ attr_reader :redactions
21
+
22
+ def redact_args(args)
23
+ args.collect{ | s| redact(s) }
24
+ end
25
+
26
+ def redact(string)
27
+ return string unless string.is_a?(String)
28
+ string.gsub(/Authorization: .*\\r\\n/, "Authorization: [redacted]\\r\\n")
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Support
3
- VERSION = "1.16.7"
3
+ VERSION = "1.16.8"
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.16.7
4
+ version: 1.16.8
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: 2021-01-28 00:00:00.000000000 Z
15
+ date: 2021-07-27 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp
@@ -48,14 +48,14 @@ dependencies:
48
48
  requirements:
49
49
  - - "~>"
50
50
  - !ruby/object:Gem::Version
51
- version: '1.1'
51
+ version: '1.9'
52
52
  type: :runtime
53
53
  prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - "~>"
57
57
  - !ruby/object:Gem::Version
58
- version: '1.1'
58
+ version: '1.9'
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: diff-lcs
61
61
  requirement: !ruby/object:Gem::Requirement
@@ -254,6 +254,7 @@ files:
254
254
  - lib/pact/consumer_contract/string_with_matching_rules.rb
255
255
  - lib/pact/errors.rb
256
256
  - lib/pact/helpers.rb
257
+ - lib/pact/http/authorization_header_redactor.rb
257
258
  - lib/pact/logging.rb
258
259
  - lib/pact/matchers.rb
259
260
  - lib/pact/matchers/actual_type.rb
@@ -318,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
319
  - !ruby/object:Gem::Version
319
320
  version: '0'
320
321
  requirements: []
321
- rubygems_version: 3.2.7
322
+ rubygems_version: 3.2.24
322
323
  signing_key:
323
324
  specification_version: 4
324
325
  summary: Shared code for Pact gems