Skip to content

fix(ffi): don't add a type matcher to a path injected from the provider state - #23

Open
YOU54F wants to merge 2 commits into
masterfrom
fix/ffi-path-provider-state
Open

YOU54F wants to merge 2 commits into
masterfrom
fix/ffi-path-provider-state

Conversation

@YOU54F

@YOU54F YOU54F commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Stacked on fix/ffi-integration-json-literals, so the first commit belongs to that PR.

Commits

fix(ffi): keep JSON header/query values without matchers and honour generator-only values

from_integration_json_v2 (path, query, header values) only looked for
pact:generator:type inside the matcher branch, and fell back to
map["value"] for any other JSON object. A header such as
X-Meta: {"alg":"HS256","typ":"JWT"} was stored as "", and a
ProviderState generator without a matcher was dropped.

  • A JSON object with pact:generator:type but no matcher now registers
    the generator and uses its value as the example.
  • A JSON object with no pact:* keys is kept as the string as written.
  • bodies.rs process_object now dispatches generator-only objects to
    process_matcher, so the generator is registered and value is used.

Fixes pact-foundation/pact-js#1058, pact-foundation#448
and the generator-only part of pact-foundation/pact-js#1088.

fix(ffi): don't add a type matcher to a path injected from the provider state

pact-js fromProviderState sends a type matcher along with the
ProviderState generator. On the request path a type matcher matches any
path, so the interaction matched requests like GET /anything/else. When
the path has a ProviderState generator, the type matcher is now dropped and
only the generator is kept, as pact-jvm and the Rust consumer DSL do. Other
matchers (e.g. regex) are kept, and headers and query parameters are
unchanged.

Fixes pact-foundation/pact-js#1088

🤖 Generated with Claude Code

YOU54F and others added 2 commits November 2, 2026 12:49
…enerator-only values

from_integration_json_v2 (path, query, header values) only looked for
pact:generator:type inside the matcher branch, and fell back to
map["value"] for any other JSON object. A header such as
X-Meta: {"alg":"HS256","typ":"JWT"} was stored as "", and a
ProviderState generator without a matcher was dropped.

- A JSON object with pact:generator:type but no matcher now registers
  the generator and uses its value as the example.
- A JSON object with no pact:* keys is kept as the string as written.
- bodies.rs process_object now dispatches generator-only objects to
  process_matcher, so the generator is registered and value is used.

Fixes pact-foundation/pact-js#1058, pact-foundation#448
and the generator-only part of pact-foundation/pact-js#1088.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er state

pact-js `fromProviderState` sends a type matcher along with the
ProviderState generator. On the request path a type matcher matches any
path, so the interaction matched requests like `GET /anything/else`. When
the path has a ProviderState generator, the type matcher is now dropped and
only the generator is kept, as pact-jvm and the Rust consumer DSL do. Other
matchers (e.g. regex) are kept, and headers and query parameters are
unchanged.

Fixes pact-foundation/pact-js#1088

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using fromProviderState should not allow mock server to match any request Header is parsed incorrectly

1 participant