Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a9b2c69
fix(pact_verifier): apply generators to form-urlencoded request bodies
ChangkeunJ Oct 26, 2026
9a93b0e
Merge pull request #592 from ChangkeunJ/fix/verifier-form-urlencoded-…
YOU54F Nov 12, 2026
30736dd
chore(pact_matching): release v2.2.0
pact-foundation[bot] Nov 12, 2026
fa5e768
Merge pull request #594 from pact-foundation/release/pact_matching
YOU54F Nov 13, 2026
e28d513
chore(pact_models): release v1.3.18
pact-foundation[bot] Nov 13, 2026
b7b66f1
Merge pull request #590 from pact-foundation/release/pact_models
YOU54F Nov 13, 2026
6932958
chore(pact_verifier): release v1.6.0
pact-foundation[bot] Nov 13, 2026
ce0ada1
Merge pull request #596 from pact-foundation/release/pact_verifier
YOU54F Nov 13, 2026
33b2736
chore(pact_verifier_cli): release v1.5.0
pact-foundation[bot] Nov 13, 2026
2e70fc1
chore(deps): update pact_mock_server v2.2.7
YOU54F Nov 13, 2026
0e10034
Merge pull request #606 from pact-foundation/deps/pact_mock_server-v2…
YOU54F Nov 13, 2026
8691d85
Merge pull request #595 from pact-foundation/release/pact_verifier_cli
YOU54F Nov 13, 2026
6ccd8ce
chore(pact_verifier_cli): extract release tarball into a workdir in D…
YOU54F Nov 13, 2026
3ae1f42
chore(pact_ffi): release v0.5.13
pact-foundation[bot] Nov 13, 2026
4fb75da
test(pact_verifier_cli): snapshot the HTML report
JP-Ellis Nov 23, 2026
4a24afc
fix(pact_verifier_cli): build against xrust 2.4
JP-Ellis Nov 23, 2026
e77a3bd
chore(pact_verifier_cli): release v1.5.1
pact-foundation[bot] Nov 23, 2026
8f12e38
fix(matching): don't report a body type mismatch for a sniffed actual…
YOU54F Nov 2, 2026
5ca016c
feat(ffi): add pactffi_remove_header to remove a header and its rules
YOU54F Nov 2, 2026
8d57f42
test(compatibility-suite): steps to remove a header from the expected…
YOU54F Nov 2, 2026
946edda
fix(models): keep matching rules and generators for each header and q…
YOU54F Oct 28, 2026
fda5345
fix: an indexed header or query rule overrides the rule for the name
YOU54F Nov 2, 2026
deaf7d0
chore(compat): support query and headers columns in V4 HTTP matching …
YOU54F Nov 2, 2026
94be013
feat: apply header and query generators to each value, with indexed keys
YOU54F Nov 2, 2026
fc9c06f
test: a query generator for a missing parameter generates a single value
YOU54F Nov 2, 2026
9a94e02
Squashed 'compatibility-suite/pact-compatibility-suite/' changes from…
YOU54F Nov 26, 2026
270db93
chore(compat): pull the V4 header, query and content-type scenarios f…
YOU54F Nov 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compatibility-suite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ maplit = "1.0.2"
pact_consumer = { path = "../rust/pact_consumer" }
pact_models = { version = "1.3.16" }
pact_matching = { version = "2.0.11" }
pact_mock_server = { version = "2.2.6" }
pact_mock_server = { version = "2.2.7" }
pact_verifier = { path = "../rust/pact_verifier" }
regex = "1.10.2"
reqwest = { version = "0.13.4", default-features = false, features = ["json"] }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:best-practices"],
"extends": [
"config:best-practices"
],
"prHourlyLimit": 0,
"prConcurrentLimit": 0,
"rebaseWhen": "conflicted",
"automerge": true
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Feature: V4 body content type without a Content-Type header
A V4 body records its own content type, so an interaction can have a typed body without a Content-Type header.
The body content type decides how the body is compared, even when the received request has no Content-Type header
and its body would be sniffed as something else. The Content-Type header is only an expectation when it is in the
interaction's headers.

Scenario: Typed body, request sent with no Content-Type header
Given an expected request configured with the following:
| body | content type |
| file: sample.pdf | application/octet-stream |
And the "content-type" header is removed from the expected request
And a request is received with the following:
| body |
| file: sample.pdf |
And the "content-type" header is removed from the received request
When the request is compared to the expected one
Then the comparison should be OK

Scenario: Typed body, request sent with a different body and no Content-Type header
Given an expected request configured with the following:
| body | content type |
| file: sample.pdf | application/octet-stream |
And the "content-type" header is removed from the expected request
And a request is received with the following:
| body |
| file: rat.jpg |
And the "content-type" header is removed from the received request
When the request is compared to the expected one
Then the comparison should NOT be OK

Scenario: Typed body, request sent with a matching Content-Type header
Given an expected request configured with the following:
| body | content type |
| file: sample.pdf | application/octet-stream |
And the "content-type" header is removed from the expected request
And a request is received with the following:
| body | content type |
| file: sample.pdf | application/octet-stream |
When the request is compared to the expected one
Then the comparison should be OK

Scenario: Typed body, request sent with a Content-Type header that declares a different type
Given an expected request configured with the following:
| body | content type |
| file: sample.pdf | application/octet-stream |
And the "content-type" header is removed from the expected request
And a request is received with the following:
| body | content type |
| file: sample.pdf | application/json |
When the request is compared to the expected one
Then the comparison should NOT be OK

Scenario: The Content-Type header is still required when it is in the interaction
Given an expected request configured with the following:
| body | content type |
| file: sample.pdf | application/octet-stream |
And a request is received with the following:
| body |
| file: sample.pdf |
And the "content-type" header is removed from the received request
When the request is compared to the expected one
Then the comparison should NOT be OK
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
Feature: Generators for each value of a header or query parameter
A generator key in the header or query category can carry a value index, written as a path: $.name[1] or
$['name'][1]. An indexed generator applies only to that value, and runs after the generator for the name. A key
without the index applies to every value, and adds the header or query parameter with a single generated value if
it is not there. Header names are matched without regard to case. A key without the leading $ is a plain name, so
ids[0] is the parameter named "ids[0]". The headers column is a JSON object of a name to a list of values, and the
expected values are a JSON list.

Background:
Given the generator test mode is set as "Provider"

Scenario: A query generator for the name applies to every value
Given a request configured with the following generators:
| query | generators |
| a=1&a=2 | JSON: { "query": { "a": { "type": "ProviderState", "expression": "${id}" } } } |
When the request is prepared for use with a "providerState" context:
| { "id": "X" } |
Then the request query parameter "a" will be ["X", "X"]

Scenario: An indexed query generator only applies to its value
Given a request configured with the following generators:
| query | generators |
| a=1&a=2&a=3 | JSON: { "query": { "$.a[1]": { "type": "ProviderState", "expression": "${id}" } } } |
When the request is prepared for use with a "providerState" context:
| { "id": "X" } |
Then the request query parameter "a" will be ["1", "X", "3"]

Scenario: An indexed query generator runs after the generator for the name
Given a request configured with the following generators:
| query | generators |
| a=1&a=2 | JSON: { "query": { "$.a[0]": { "type": "ProviderState", "expression": "${first}" }, "a": { "type": "ProviderState", "expression": "${all}" } } } |
When the request is prepared for use with a "providerState" context:
| { "first": "F", "all": "A" } |
Then the request query parameter "a" will be ["F", "A"]

Scenario: An indexed query generator for a value that is not there is ignored
Given a request configured with the following generators:
| query | generators |
| a=1 | JSON: { "query": { "$.a[3]": { "type": "ProviderState", "expression": "${id}" } } } |
When the request is prepared for use with a "providerState" context:
| { "id": "X" } |
Then the request query parameter "a" will be ["1"]

Scenario: A query generator key without the leading $ is a plain parameter name
Given a request configured with the following generators:
| query | generators |
| ids=1&ids[0]=2 | JSON: { "query": { "ids[0]": { "type": "ProviderState", "expression": "${id}" } } } |
When the request is prepared for use with a "providerState" context:
| { "id": "X" } |
Then the request query parameter "ids" will be ["1"]
And the request query parameter "ids[0]" will be ["X"]

Scenario: A query generator for a parameter that is not there generates a single value
Given a request configured with the following generators:
| query | generators |
| a=1 | JSON: { "query": { "id": { "type": "ProviderState", "expression": "${id}" } } } |
When the request is prepared for use with a "providerState" context:
| { "id": "X" } |
Then the request query parameter "a" will be ["1"]
And the request query parameter "id" will be ["X"]

Scenario: A header generator for the name applies to every value
Given a request configured with the following generators:
| headers | generators |
| { "X-Request": ["a", "b"] } | JSON: { "header": { "X-Request": { "type": "ProviderState", "expression": "${id}" } } } |
When the request is prepared for use with a "providerState" context:
| { "id": "X" } |
Then the request header "X-Request" will be ["X", "X"]

Scenario: An indexed header generator only applies to its value
Given a request configured with the following generators:
| headers | generators |
| { "X-Request": ["a", "b", "c"] } | JSON: { "header": { "$['X-Request'][1]": { "type": "ProviderState", "expression": "${id}" } } } |
When the request is prepared for use with a "providerState" context:
| { "id": "X" } |
Then the request header "X-Request" will be ["a", "X", "c"]

Scenario: Header generators match the header name without regard to case
Given a request configured with the following generators:
| headers | generators |
| { "X-Request": ["a", "b"] } | JSON: { "header": { "x-request": { "type": "ProviderState", "expression": "${all}" }, "$['X-REQUEST'][1]": { "type": "ProviderState", "expression": "${second}" } } } |
When the request is prepared for use with a "providerState" context:
| { "all": "A", "second": "S" } |
Then the request header "X-Request" will be ["A", "S"]

Scenario: A header generator for a header that is not there generates a single value
Given a request configured with the following generators:
| generators |
| JSON: { "header": { "X-Id": { "type": "ProviderState", "expression": "${id}" } } } |
When the request is prepared for use with a "providerState" context:
| { "id": "X" } |
Then the request header "X-Id" will be ["X"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
Feature: Matching rules for each value of a header or query parameter
Headers and query parameters are a list of values for each name. A matching rule key in the header or query
category can carry a value index, written as a path: $.name[1] or $['name'][1]. An indexed rule applies only to
that value, and overrides the rule for the name for that value. A key without the index applies to every value.
The headers column is a JSON object of a name to a list of values, so values can contain commas.

Scenario: An indexed query rule only applies to its value (positive case)
Given an expected request configured with the following:
| query | matching rules |
| a=x&a=100 | JSON: { "query": { "$.a[1]": { "matchers": [{ "match": "regex", "regex": "^[0-9]+$" }] } } } |
And a request is received with the following:
| query |
| a=x&a=42 |
When the request is compared to the expected one
Then the comparison should be OK

Scenario: An indexed query rule only applies to its value (negative case)
Given an expected request configured with the following:
| query | matching rules |
| a=x&a=100 | JSON: { "query": { "$.a[1]": { "matchers": [{ "match": "regex", "regex": "^[0-9]+$" }] } } } |
And a request is received with the following:
| query |
| a=x&a=abc |
When the request is compared to the expected one
Then the comparison should NOT be OK

Scenario: Values without an indexed query rule are compared for equality
Given an expected request configured with the following:
| query | matching rules |
| a=x&a=100 | JSON: { "query": { "$.a[1]": { "matchers": [{ "match": "regex", "regex": "^[0-9]+$" }] } } } |
And a request is received with the following:
| query |
| a=y&a=42 |
When the request is compared to the expected one
Then the comparison should NOT be OK

Scenario: An indexed query rule overrides the rule for the name for that value (positive case)
Given an expected request configured with the following:
| query | matching rules |
| a=x&a=100 | JSON: { "query": { "a": { "matchers": [{ "match": "regex", "regex": "^[a-z]+$" }] }, "$.a[1]": { "matchers": [{ "match": "regex", "regex": "^[0-9]+$" }] } } } |
And a request is received with the following:
| query |
| a=y&a=42 |
When the request is compared to the expected one
Then the comparison should be OK

Scenario: An indexed query rule overrides the rule for the name for that value (negative case)
Given an expected request configured with the following:
| query | matching rules |
| a=x&a=100 | JSON: { "query": { "a": { "matchers": [{ "match": "regex", "regex": "^[a-z]+$" }] }, "$.a[1]": { "matchers": [{ "match": "regex", "regex": "^[0-9]+$" }] } } } |
And a request is received with the following:
| query |
| a=y&a=z |
When the request is compared to the expected one
Then the comparison should NOT be OK

Scenario: A query parameter name with brackets is a plain name
Given an expected request configured with the following:
| query | matching rules |
| ids[0]=100 | JSON: { "query": { "ids[0]": { "matchers": [{ "match": "regex", "regex": "^[0-9]+$" }] } } } |
And a request is received with the following:
| query |
| ids[0]=42 |
When the request is compared to the expected one
Then the comparison should be OK

Scenario: An indexed header rule only applies to its value (positive case)
Given an expected request configured with the following:
| headers | matching rules |
| { "X-Request": ["a", "100"] } | JSON: { "header": { "$['X-Request'][1]": { "matchers": [{ "match": "regex", "regex": "^[0-9]+$" }] } } } |
And a request is received with the following:
| headers |
| { "X-Request": ["a", "42"] } |
When the request is compared to the expected one
Then the comparison should be OK

Scenario: An indexed header rule only applies to its value (negative case)
Given an expected request configured with the following:
| headers | matching rules |
| { "X-Request": ["a", "100"] } | JSON: { "header": { "$['X-Request'][1]": { "matchers": [{ "match": "regex", "regex": "^[0-9]+$" }] } } } |
And a request is received with the following:
| headers |
| { "X-Request": ["a", "abc"] } |
When the request is compared to the expected one
Then the comparison should NOT be OK

Scenario: An indexed header rule overrides the rule for the name for that value
Given an expected request configured with the following:
| headers | matching rules |
| { "X-Request": ["a", "100"] } | JSON: { "header": { "X-Request": { "matchers": [{ "match": "regex", "regex": "^[a-z]+$" }] }, "$['X-Request'][1]": { "matchers": [{ "match": "regex", "regex": "^[0-9]+$" }] } } } |
And a request is received with the following:
| headers |
| { "X-Request": ["b", "42"] } |
When the request is compared to the expected one
Then the comparison should be OK

Scenario: Header names in indexed rule keys are not case sensitive
Given an expected request configured with the following:
| headers | matching rules |
| { "X-Request": ["a", "100"] } | JSON: { "header": { "$['x-request'][1]": { "matchers": [{ "match": "regex", "regex": "^[0-9]+$" }] } } } |
And a request is received with the following:
| headers |
| { "x-request": ["a", "42"] } |
When the request is compared to the expected one
Then the comparison should be OK

Scenario: Header values can contain commas
Given an expected request configured with the following:
| headers | matching rules |
| { "X-Request": ["a", "Tue, 01 Jan 2030 10:00:00 GMT"] } | JSON: { "header": { "$['X-Request'][1]": { "matchers": [{ "match": "regex", "regex": "^[A-Z][a-z]{2}, .* GMT$" }] } } } |
And a request is received with the following:
| headers |
| { "X-Request": ["a", "Wed, 02 Jan 2030 11:00:00 GMT"] } |
When the request is compared to the expected one
Then the comparison should be OK
Loading