pact-support 1.16.4 → 1.16.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/lib/pact/consumer_contract/interaction_v2_parser.rb +12 -2
- data/lib/pact/consumer_contract/query.rb +4 -0
- data/lib/pact/consumer_contract/query_hash.rb +4 -1
- data/lib/pact/reification.rb +13 -9
- data/lib/pact/shared/request.rb +13 -1
- data/lib/pact/support/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e0c625aaae1df3561bcc4931619c302e86e7a095532a796ccbb0d72c25fa1a0
|
4
|
+
data.tar.gz: 5cecf64f0fcdd42ba68cd87fe117a3de729b96f1cd22ae4f47dcb171f78c0fc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcb61af6781e17f964725fdd44452c3fa63b146bc71240c5a2cff6580d7572da316e41af133d4c9ac814d2a8200a72b250e32333292567718c43fbee88aaf3c0
|
7
|
+
data.tar.gz: 661cf6909d54987e5e9e63ba38ce2b92ac00c2823853ac178670a204ce80adf96084c9665cf622f7a04ce2e50e7948b755c07ffc0d14e344492908bb033966d8
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
<a name="v1.16.5"></a>
|
2
|
+
### v1.16.5 (2020-11-25)
|
3
|
+
|
4
|
+
#### Bug Fixes
|
5
|
+
|
6
|
+
* 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))
|
7
|
+
|
1
8
|
<a name="v1.16.4"></a>
|
2
9
|
### v1.16.4 (2020-11-13)
|
3
10
|
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Pact Support
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.
|
3
|
+
[![Build Status](https://travis-ci.com/pact-foundation/pact-support.svg?branch=master)](https://travis-ci.com/pact-foundation/pact-support)
|
4
4
|
|
5
5
|
Provides shared code for the Pact gems
|
@@ -23,12 +23,22 @@ module Pact
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.parse_request request_hash, options
|
26
|
-
|
26
|
+
original_query_string = request_hash['query']
|
27
|
+
query_is_string = original_query_string.is_a?(String)
|
28
|
+
if query_is_string
|
27
29
|
request_hash = request_hash.dup
|
28
30
|
request_hash['query'] = Pact::Query.parse_string(request_hash['query'])
|
29
31
|
end
|
32
|
+
# The query has to be a hash at this stage for the matching rules to be applied
|
30
33
|
request_hash = Pact::MatchingRules.merge(request_hash, request_hash['matchingRules'], options)
|
31
|
-
|
34
|
+
# The original query string needs to be passed in to the constructor so it can be used
|
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)
|
40
|
+
end
|
41
|
+
request = Pact::Request::Expected.from_hash(request_hash)
|
32
42
|
end
|
33
43
|
|
34
44
|
def self.parse_response response_hash, options
|
@@ -8,8 +8,11 @@ module Pact
|
|
8
8
|
include ActiveSupportSupport
|
9
9
|
include SymbolizeKeys
|
10
10
|
|
11
|
-
|
11
|
+
attr_reader :original_string
|
12
|
+
|
13
|
+
def initialize(query, original_string = nil)
|
12
14
|
@hash = query.nil? ? query : convert_to_hash_of_arrays(query)
|
15
|
+
@original_string = original_string
|
13
16
|
end
|
14
17
|
|
15
18
|
def as_json(opts = {})
|
data/lib/pact/reification.rb
CHANGED
@@ -27,15 +27,19 @@ module Pact
|
|
27
27
|
when Pact::QueryString
|
28
28
|
from_term(term.query)
|
29
29
|
when Pact::QueryHash
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
v.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
if term.original_string
|
31
|
+
term.original_string
|
32
|
+
else
|
33
|
+
from_term(term.query).map { |k, v|
|
34
|
+
if v.nil?
|
35
|
+
k
|
36
|
+
elsif v.is_a?(Array) #For cases where there are multiple instance of the same parameter
|
37
|
+
v.map { |x| "#{k}=#{escape(x)}"}.join('&')
|
38
|
+
else
|
39
|
+
"#{k}=#{escape(v)}"
|
40
|
+
end
|
41
|
+
}.join('&')
|
42
|
+
end
|
39
43
|
when Pact::StringWithMatchingRules
|
40
44
|
String.new(term)
|
41
45
|
else
|
data/lib/pact/shared/request.rb
CHANGED
@@ -14,7 +14,7 @@ module Pact
|
|
14
14
|
@path = path
|
15
15
|
@headers = Hash === headers ? Headers.new(headers) : headers # Could be a NullExpectation - TODO make this more elegant
|
16
16
|
@body = body
|
17
|
-
|
17
|
+
set_query(query)
|
18
18
|
end
|
19
19
|
|
20
20
|
def to_hash
|
@@ -89,6 +89,18 @@ module Pact
|
|
89
89
|
def display_query
|
90
90
|
(query.nil? || query.empty?) ? '' : "?#{Pact::Reification.from_term(query)}"
|
91
91
|
end
|
92
|
+
|
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
|
92
104
|
end
|
93
105
|
end
|
94
106
|
end
|
data/lib/pact/support/version.rb
CHANGED
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.
|
4
|
+
version: 1.16.5
|
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-11-
|
15
|
+
date: 2020-11-25 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: randexp
|
@@ -96,14 +96,14 @@ dependencies:
|
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
99
|
+
version: '13.0'
|
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: '13.0'
|
107
107
|
- !ruby/object:Gem::Dependency
|
108
108
|
name: webmock
|
109
109
|
requirement: !ruby/object:Gem::Requirement
|