pact-support 1.16.10 → 1.17.0.pre.rc1
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 +4 -4
- data/CHANGELOG.md +2 -63
- data/README.md +1 -1
- data/lib/pact/consumer_contract/interaction_v2_parser.rb +2 -12
- data/lib/pact/consumer_contract/pact_file.rb +4 -7
- data/lib/pact/consumer_contract/query.rb +7 -29
- data/lib/pact/consumer_contract/query_hash.rb +2 -21
- data/lib/pact/reification.rb +11 -17
- data/lib/pact/shared/active_support_support.rb +15 -27
- data/lib/pact/shared/request.rb +4 -13
- data/lib/pact/support/version.rb +1 -1
- data/lib/pact/term.rb +4 -5
- metadata +19 -20
- data/lib/pact/http/authorization_header_redactor.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ad189ebbcb209c5b46b6ebbef2e2ee3dcfcfa3c0877d8c781e89d899dc04119
|
4
|
+
data.tar.gz: 191b4922928c01b2c5ec96fb29f8be80457d4b68b36a39d3d242bbd0df34a1d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8e83c4eec4cf74f570c43c7c1dd2a7ecfd9d458fb931b0aa6b3c1cfa0d420200add510a6ba29ae6193ab39eff9b69638955b63966c2753a279ce805662331c9
|
7
|
+
data.tar.gz: 418258a4ceded92b22f9038c358809ce03d623b1fc4e0bff90ab380dd7d03405eacde06f6dddf2673b265dd830122f8cce824d860ab5beae75245879a96452c0
|
data/CHANGELOG.md
CHANGED
@@ -1,66 +1,5 @@
|
|
1
|
-
<a name="v1.
|
2
|
-
### v1.
|
3
|
-
|
4
|
-
#### Bug Fixes
|
5
|
-
|
6
|
-
* change expgen to a runtime dependency ([da81634](/../../commit/da81634))
|
7
|
-
|
8
|
-
<a name="v1.16.9"></a>
|
9
|
-
### v1.16.9 (2021-09-30)
|
10
|
-
|
11
|
-
#### Bug Fixes
|
12
|
-
|
13
|
-
* remove randexp dependency (#91) ([794fd4e](/../../commit/794fd4e))
|
14
|
-
|
15
|
-
<a name="v1.16.8"></a>
|
16
|
-
### v1.16.8 (2021-07-27)
|
17
|
-
|
18
|
-
#### Bug Fixes
|
19
|
-
|
20
|
-
* log HTTP request for pacts retrieved by URL when requested with verbose=true ([3288b81](/../../commit/3288b81))
|
21
|
-
|
22
|
-
<a name="v1.16.7"></a>
|
23
|
-
### v1.16.7 (2021-01-28)
|
24
|
-
|
25
|
-
#### Bug Fixes
|
26
|
-
|
27
|
-
* dynamically parse actual query to match expected format ([a86a3e3](/../../commit/a86a3e3))
|
28
|
-
|
29
|
-
<a name="v1.16.6"></a>
|
30
|
-
### v1.16.6 (2021-01-28)
|
31
|
-
|
32
|
-
#### Bug Fixes
|
33
|
-
|
34
|
-
* raise Pact::Error not RuntimeError when invalid constructor arguments are supplied to a Pact::Term ([d9fb8ea](/../../commit/d9fb8ea))
|
35
|
-
* update active support support for Ruby 3.0 ([6c30d42](/../../commit/6c30d42))
|
36
|
-
|
37
|
-
<a name="v1.16.5"></a>
|
38
|
-
### v1.16.5 (2020-11-25)
|
39
|
-
|
40
|
-
#### Bug Fixes
|
41
|
-
|
42
|
-
* maintain the original string query for the provider verification while also parsing the string query into a hash to allow the matching rules to be applied correctly for use in the mock service on the consumer side ([12105dd](/../../commit/12105dd))
|
43
|
-
|
44
|
-
<a name="v1.16.4"></a>
|
45
|
-
### v1.16.4 (2020-11-13)
|
46
|
-
|
47
|
-
#### Bug Fixes
|
48
|
-
|
49
|
-
* ensure expected and actual query strings are parsed consistently ([4e9ca9c](/../../commit/4e9ca9c))
|
50
|
-
|
51
|
-
<a name="v1.16.3"></a>
|
52
|
-
### v1.16.3 (2020-11-10)
|
53
|
-
|
54
|
-
#### Bug Fixes
|
55
|
-
|
56
|
-
* add missing params_hash_has_key ([700efa7](/../../commit/700efa7))
|
57
|
-
|
58
|
-
<a name="v1.16.2"></a>
|
59
|
-
### v1.16.2 (2020-11-07)
|
60
|
-
|
61
|
-
#### Bug Fixes
|
62
|
-
|
63
|
-
* removed undefined depth from query ([53a373d](/../../commit/53a373d))
|
1
|
+
<a name="v1.17.0-rc1"></a>
|
2
|
+
### v1.17.0-rc1 (2020-11-06)
|
64
3
|
|
65
4
|
<a name="v1.16.1"></a>
|
66
5
|
### v1.16.1 (2020-11-06)
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Pact Support
|
2
2
|
|
3
|
-
](https://travis-ci.org/pact-foundation/pact-support)
|
4
4
|
|
5
5
|
Provides shared code for the Pact gems
|
@@ -23,22 +23,12 @@ module Pact
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.parse_request request_hash, options
|
26
|
-
|
27
|
-
query_is_string = original_query_string.is_a?(String)
|
28
|
-
if query_is_string
|
26
|
+
if request_hash['query'].is_a?(String)
|
29
27
|
request_hash = request_hash.dup
|
30
28
|
request_hash['query'] = Pact::Query.parse_string(request_hash['query'])
|
31
29
|
end
|
32
|
-
# The query has to be a hash at this stage for the matching rules to be applied
|
33
30
|
request_hash = Pact::MatchingRules.merge(request_hash, request_hash['matchingRules'], options)
|
34
|
-
|
35
|
-
# when the request is replayed. Otherwise, we loose the square brackets because they get lost
|
36
|
-
# in the translation between string => structured object, as we don't know/store which
|
37
|
-
# query string convention was used.
|
38
|
-
if query_is_string
|
39
|
-
request_hash['query'] = Pact::QueryHash.new(request_hash['query'], original_query_string, Pact::Query.parsed_as_nested?(request_hash['query']))
|
40
|
-
end
|
41
|
-
request = Pact::Request::Expected.from_hash(request_hash)
|
31
|
+
Pact::Request::Expected.from_hash(request_hash)
|
42
32
|
end
|
43
33
|
|
44
34
|
def self.parse_response response_hash, options
|
@@ -1,6 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require "pact/configuration"
|
3
|
-
require "pact/http/authorization_header_redactor"
|
1
|
+
require 'net/http'
|
4
2
|
|
5
3
|
module Pact
|
6
4
|
module PactFile
|
@@ -83,7 +81,7 @@ module Pact
|
|
83
81
|
request = Net::HTTP::Get.new(uri)
|
84
82
|
request = prepare_auth(request, options) if options[:username] || options[:token]
|
85
83
|
|
86
|
-
http = prepare_request(uri
|
84
|
+
http = prepare_request(uri)
|
87
85
|
response = perform_http_request(http, request, options)
|
88
86
|
|
89
87
|
if response.is_a?(Net::HTTPRedirection)
|
@@ -91,7 +89,7 @@ module Pact
|
|
91
89
|
req = Net::HTTP::Get.new(uri)
|
92
90
|
req = prepare_auth(req, options) if options[:username] || options[:token]
|
93
91
|
|
94
|
-
http = prepare_request(uri
|
92
|
+
http = prepare_request(uri)
|
95
93
|
response = perform_http_request(http, req, options)
|
96
94
|
end
|
97
95
|
response
|
@@ -103,12 +101,11 @@ module Pact
|
|
103
101
|
request
|
104
102
|
end
|
105
103
|
|
106
|
-
def prepare_request(uri
|
104
|
+
def prepare_request(uri)
|
107
105
|
http = Net::HTTP.new(uri.host, uri.port, :ENV)
|
108
106
|
http.use_ssl = (uri.scheme == 'https')
|
109
107
|
http.ca_file = ENV['SSL_CERT_FILE'] if ENV['SSL_CERT_FILE'] && ENV['SSL_CERT_FILE'] != ''
|
110
108
|
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]
|
112
109
|
http
|
113
110
|
end
|
114
111
|
|
@@ -6,8 +6,6 @@ module Pact
|
|
6
6
|
DEFAULT_SEP = /[&;] */n
|
7
7
|
COMMON_SEP = { ";" => /[;] */n, ";," => /[;,] */n, "&" => /[&] */n }
|
8
8
|
|
9
|
-
class NestedQuery < Hash; end
|
10
|
-
|
11
9
|
def self.create query
|
12
10
|
if query.is_a? Hash
|
13
11
|
Pact::QueryHash.new(query)
|
@@ -16,20 +14,12 @@ module Pact
|
|
16
14
|
end
|
17
15
|
end
|
18
16
|
|
19
|
-
def self.is_a_query_object?(object)
|
20
|
-
object.is_a?(Pact::QueryHash) || object.is_a?(Pact::QueryString)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.parsed_as_nested?(object)
|
24
|
-
object.is_a?(NestedQuery)
|
25
|
-
end
|
26
|
-
|
27
17
|
def self.parse_string query_string
|
28
|
-
parsed_query =
|
18
|
+
parsed_query = parse_query(query_string)
|
29
19
|
|
30
20
|
# If Rails nested params...
|
31
|
-
if parsed_query.keys.any?{ | key| key
|
32
|
-
|
21
|
+
if parsed_query.keys.any?{ | key| key.include?("[") }
|
22
|
+
parse_nested_query(query_string)
|
33
23
|
else
|
34
24
|
parsed_query.each_with_object({}) do | (key, value), new_hash |
|
35
25
|
new_hash[key] = [*value]
|
@@ -39,7 +29,7 @@ module Pact
|
|
39
29
|
|
40
30
|
# Ripped from Rack to avoid adding an unnecessary dependency, thank you Rack
|
41
31
|
# https://github.com/rack/rack/blob/649c72bab9e7b50d657b5b432d0c205c95c2be07/lib/rack/utils.rb
|
42
|
-
def self.
|
32
|
+
def self.parse_query(qs, d = nil, &unescaper)
|
43
33
|
unescaper ||= method(:unescape)
|
44
34
|
|
45
35
|
params = {}
|
@@ -62,7 +52,7 @@ module Pact
|
|
62
52
|
return params.to_h
|
63
53
|
end
|
64
54
|
|
65
|
-
def self.
|
55
|
+
def self.parse_nested_query(qs, d = nil)
|
66
56
|
params = {}
|
67
57
|
|
68
58
|
unless qs.nil? || qs.empty?
|
@@ -73,7 +63,7 @@ module Pact
|
|
73
63
|
end
|
74
64
|
end
|
75
65
|
|
76
|
-
return
|
66
|
+
return params.to_h
|
77
67
|
end
|
78
68
|
|
79
69
|
def self.normalize_params(params, name, v)
|
@@ -109,7 +99,7 @@ module Pact
|
|
109
99
|
else
|
110
100
|
params[k] ||= {}
|
111
101
|
raise ParameterTypeError, "expected Hash (got #{params[k].class.name}) for param `#{k}'" unless params_hash_type?(params[k])
|
112
|
-
params[k] = normalize_params(params[k], after, v)
|
102
|
+
params[k] = normalize_params(params[k], after, v, depth - 1)
|
113
103
|
end
|
114
104
|
|
115
105
|
params
|
@@ -119,18 +109,6 @@ module Pact
|
|
119
109
|
obj.is_a?(Hash)
|
120
110
|
end
|
121
111
|
|
122
|
-
def self.params_hash_has_key?(hash, key)
|
123
|
-
return false if key =~ /\[\]/
|
124
|
-
|
125
|
-
key.split(/[\[\]]+/).inject(hash) do |h, part|
|
126
|
-
next h if part == ''
|
127
|
-
return false unless params_hash_type?(h) && h.key?(part)
|
128
|
-
h[part]
|
129
|
-
end
|
130
|
-
|
131
|
-
true
|
132
|
-
end
|
133
|
-
|
134
112
|
def self.unescape(s, encoding = Encoding::UTF_8)
|
135
113
|
URI.decode_www_form_component(s, encoding)
|
136
114
|
end
|
@@ -8,20 +8,8 @@ module Pact
|
|
8
8
|
include ActiveSupportSupport
|
9
9
|
include SymbolizeKeys
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
def initialize(query, original_string = nil, nested = false)
|
11
|
+
def initialize(query)
|
14
12
|
@hash = query.nil? ? query : convert_to_hash_of_arrays(query)
|
15
|
-
@original_string = original_string
|
16
|
-
@nested = nested
|
17
|
-
end
|
18
|
-
|
19
|
-
def nested?
|
20
|
-
@nested
|
21
|
-
end
|
22
|
-
|
23
|
-
def any_key_contains_square_brackets?
|
24
|
-
query.keys.any?{ |key| key =~ /\[.*\]/ }
|
25
13
|
end
|
26
14
|
|
27
15
|
def as_json(opts = {})
|
@@ -44,14 +32,7 @@ module Pact
|
|
44
32
|
# from the actual query string.
|
45
33
|
def difference(other)
|
46
34
|
require 'pact/matchers' # avoid recursive loop between this file, pact/reification and pact/matchers
|
47
|
-
|
48
|
-
if any_key_contains_square_brackets?
|
49
|
-
other_query_hash_non_nested = Query.parse_string_as_non_nested_query(other.query)
|
50
|
-
Pact::Matchers.diff(query, convert_to_hash_of_arrays(other_query_hash_non_nested), allow_unexpected_keys: false)
|
51
|
-
else
|
52
|
-
other_query_hash = Query.parse_string(other.query)
|
53
|
-
Pact::Matchers.diff(query, symbolize_keys(convert_to_hash_of_arrays(other_query_hash)), allow_unexpected_keys: false)
|
54
|
-
end
|
35
|
+
Pact::Matchers.diff(query, symbolize_keys(CGI::parse(other.query)), allow_unexpected_keys: false)
|
55
36
|
end
|
56
37
|
|
57
38
|
def query
|
data/lib/pact/reification.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'randexp'
|
2
2
|
require 'pact/term'
|
3
3
|
require 'pact/something_like'
|
4
4
|
require 'pact/array_like'
|
@@ -13,10 +13,8 @@ module Pact
|
|
13
13
|
|
14
14
|
def self.from_term(term)
|
15
15
|
case term
|
16
|
-
when Pact::Term, Pact::SomethingLike, Pact::ArrayLike
|
16
|
+
when Pact::Term, Regexp, Pact::SomethingLike, Pact::ArrayLike
|
17
17
|
from_term(term.generate)
|
18
|
-
when Regexp
|
19
|
-
from_term(Expgen.gen(term))
|
20
18
|
when Hash
|
21
19
|
term.inject({}) do |mem, (key,t)|
|
22
20
|
mem[key] = from_term(t)
|
@@ -29,19 +27,15 @@ module Pact
|
|
29
27
|
when Pact::QueryString
|
30
28
|
from_term(term.query)
|
31
29
|
when Pact::QueryHash
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
"#{k}=#{escape(v)}"
|
42
|
-
end
|
43
|
-
}.join('&')
|
44
|
-
end
|
30
|
+
from_term(term.query).map { |k, v|
|
31
|
+
if v.nil?
|
32
|
+
k
|
33
|
+
elsif v.is_a?(Array) #For cases where there are multiple instance of the same parameter
|
34
|
+
v.map { |x| "#{k}=#{escape(x)}"}.join('&')
|
35
|
+
else
|
36
|
+
"#{k}=#{escape(v)}"
|
37
|
+
end
|
38
|
+
}.join('&')
|
45
39
|
when Pact::StringWithMatchingRules
|
46
40
|
String.new(term)
|
47
41
|
else
|
@@ -2,28 +2,22 @@
|
|
2
2
|
|
3
3
|
module Pact
|
4
4
|
module ActiveSupportSupport
|
5
|
+
|
5
6
|
extend self
|
6
7
|
|
7
8
|
def fix_all_the_things thing
|
8
|
-
if
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
thing
|
18
|
-
elsif thing.class.name.start_with?("Pact")
|
19
|
-
warn_about_regexp(thing)
|
20
|
-
thing
|
21
|
-
else
|
22
|
-
thing
|
9
|
+
if thing.is_a?(Regexp)
|
10
|
+
fix_regexp(thing)
|
11
|
+
elsif thing.is_a?(Array)
|
12
|
+
thing.each{ | it | fix_all_the_things it }
|
13
|
+
elsif thing.is_a?(Hash)
|
14
|
+
thing.values.each{ | it | fix_all_the_things it }
|
15
|
+
elsif thing.class.name.start_with?("Pact")
|
16
|
+
thing.instance_variables.collect{ | iv_name | thing.instance_variable_get(iv_name)}.each do | iv |
|
17
|
+
fix_all_the_things iv
|
23
18
|
end
|
24
|
-
else
|
25
|
-
thing
|
26
19
|
end
|
20
|
+
thing
|
27
21
|
end
|
28
22
|
|
29
23
|
# ActiveSupport JSON overwrites (i.e. TRAMPLES) the json methods of the Regexp class directly
|
@@ -33,7 +27,10 @@ module Pact
|
|
33
27
|
# original as_json to the Regexp instances in the ConsumerContract before we write them to the
|
34
28
|
# pact file. If anyone can find a better way, please submit a pull request ASAP!
|
35
29
|
def fix_regexp regexp
|
36
|
-
|
30
|
+
def regexp.as_json options = {}
|
31
|
+
{:json_class => 'Regexp', "o" => self.options, "s" => self.source }
|
32
|
+
end
|
33
|
+
regexp
|
37
34
|
end
|
38
35
|
|
39
36
|
# Having Active Support JSON loaded somehow kills the formatting of pretty_generate for objects.
|
@@ -52,14 +49,5 @@ module Pact
|
|
52
49
|
json.gsub(/\\u([0-9A-Za-z]{4})/) {|s| [$1.to_i(16)].pack("U")}
|
53
50
|
end
|
54
51
|
|
55
|
-
def warn_about_regexp(thing)
|
56
|
-
thing.instance_variables.each do | iv_name |
|
57
|
-
iv = thing.instance_variable_get(iv_name)
|
58
|
-
if iv.is_a?(Regexp)
|
59
|
-
require 'pact/configuration'
|
60
|
-
Pact.configuration.error_stream.puts("WARN: Instance variable #{iv_name} for class #{thing.class.name} is a Regexp and isn't been serialized properly. Please raise an issue at https://github.com/pact-foundation/pact-support/issues/new.")
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
52
|
end
|
65
53
|
end
|
data/lib/pact/shared/request.rb
CHANGED
@@ -3,7 +3,9 @@ require 'pact/consumer_contract/headers'
|
|
3
3
|
require 'pact/consumer_contract/query'
|
4
4
|
|
5
5
|
module Pact
|
6
|
+
|
6
7
|
module Request
|
8
|
+
|
7
9
|
class Base
|
8
10
|
include Pact::SymbolizeKeys
|
9
11
|
|
@@ -14,7 +16,7 @@ module Pact
|
|
14
16
|
@path = path
|
15
17
|
@headers = Hash === headers ? Headers.new(headers) : headers # Could be a NullExpectation - TODO make this more elegant
|
16
18
|
@body = body
|
17
|
-
|
19
|
+
@query = is_unspecified?(query) ? query : Pact::Query.create(query)
|
18
20
|
end
|
19
21
|
|
20
22
|
def to_hash
|
@@ -90,17 +92,6 @@ module Pact
|
|
90
92
|
(query.nil? || query.empty?) ? '' : "?#{Pact::Reification.from_term(query)}"
|
91
93
|
end
|
92
94
|
|
93
|
-
def set_query(query)
|
94
|
-
@query = if is_unspecified?(query)
|
95
|
-
query
|
96
|
-
else
|
97
|
-
if Pact::Query.is_a_query_object?(query)
|
98
|
-
query
|
99
|
-
else
|
100
|
-
Pact::Query.create(query)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
95
|
end
|
105
96
|
end
|
106
|
-
end
|
97
|
+
end
|
data/lib/pact/support/version.rb
CHANGED
data/lib/pact/term.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'pact/shared/active_support_support'
|
2
2
|
require 'json/add/regexp'
|
3
|
-
require 'pact/errors'
|
4
3
|
|
5
4
|
module Pact
|
6
5
|
class Term
|
@@ -26,13 +25,13 @@ module Pact
|
|
26
25
|
def initialize(attributes = {})
|
27
26
|
@generate = attributes[:generate]
|
28
27
|
@matcher = attributes[:matcher]
|
29
|
-
raise
|
30
|
-
raise
|
31
|
-
raise
|
28
|
+
raise "Please specify a matcher for the Term" unless @matcher != nil
|
29
|
+
raise "Please specify a value to generate for the Term" unless @generate != nil
|
30
|
+
raise "Value to generate \"#{@generate}\" does not match regular expression #{@matcher.inspect}" unless @generate =~ @matcher
|
32
31
|
end
|
33
32
|
|
34
33
|
def to_hash
|
35
|
-
{ json_class: self.class.name, data: { generate: generate, matcher: fix_regexp(matcher)
|
34
|
+
{ json_class: self.class.name, data: { generate: generate, matcher: fix_regexp(matcher)} }
|
36
35
|
end
|
37
36
|
|
38
37
|
def as_json(options = {})
|
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.
|
4
|
+
version: 1.17.0.pre.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Fraser
|
@@ -12,64 +12,64 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2020-11-06 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
|
-
name:
|
18
|
+
name: randexp
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
21
|
- - "~>"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 0.1.7
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
28
|
- - "~>"
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
30
|
+
version: 0.1.7
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
32
|
+
name: term-ansicolor
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
35
|
- - "~>"
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '1.
|
37
|
+
version: '1.0'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
42
|
- - "~>"
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: '1.
|
44
|
+
version: '1.0'
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
|
-
name:
|
46
|
+
name: awesome_print
|
47
47
|
requirement: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
49
|
- - "~>"
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version: '1.
|
51
|
+
version: '1.1'
|
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.
|
58
|
+
version: '1.1'
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
60
|
+
name: diff-lcs
|
61
61
|
requirement: !ruby/object:Gem::Requirement
|
62
62
|
requirements:
|
63
63
|
- - "~>"
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: '
|
65
|
+
version: '1.4'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
70
|
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '
|
72
|
+
version: '1.4'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: rspec
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,14 +96,14 @@ dependencies:
|
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
99
|
+
version: 10.0.3
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
102
|
version_requirements: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
104
|
- - "~>"
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
106
|
+
version: 10.0.3
|
107
107
|
- !ruby/object:Gem::Dependency
|
108
108
|
name: webmock
|
109
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -254,7 +254,6 @@ 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
|
258
257
|
- lib/pact/logging.rb
|
259
258
|
- lib/pact/matchers.rb
|
260
259
|
- lib/pact/matchers/actual_type.rb
|
@@ -315,11 +314,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
315
314
|
version: '2.0'
|
316
315
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
317
316
|
requirements:
|
318
|
-
- - "
|
317
|
+
- - ">"
|
319
318
|
- !ruby/object:Gem::Version
|
320
|
-
version:
|
319
|
+
version: 1.3.1
|
321
320
|
requirements: []
|
322
|
-
rubygems_version: 3.
|
321
|
+
rubygems_version: 3.1.4
|
323
322
|
signing_key:
|
324
323
|
specification_version: 4
|
325
324
|
summary: Shared code for Pact gems
|
@@ -1,32 +0,0 @@
|
|
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
|