Skip to content

feat(ffi): pactffi_remove_header, and match a typed body without a Content-Type header - #20

Open
YOU54F wants to merge 3 commits into
masterfrom
feat/ffi-remove-header
Open

YOU54F wants to merge 3 commits into
masterfrom
feat/ffi-remove-header

Conversation

@YOU54F

@YOU54F YOU54F commented Nov 9, 2026

Copy link
Copy Markdown
Owner

The steps run the scenarios in YOU54F/pact-compatibility-suite#2. CI runs against the vendored suite copy, which doesn't include those scenarios yet.

Commits

fix(matching): don't report a body type mismatch for a sniffed actual content type

When the actual request or response has no Content-Type header, its content
type is only a guess from the body bytes (the mock server stores that guess on
the body). Compare the body using the expected content type instead of
reporting a BodyTypeMismatch, so a binary body sent without a header can
match an expected application/octet-stream body.

Refs pact-foundation/pact-go#263

feat(ffi): add pactffi_remove_header to remove a header and its rules

Removes a header (case-insensitively) from the request or response of an
interaction, along with its matching rules and generators. This lets a
wrapper drop the Content-Type header that pactffi_with_body and
pactffi_with_binary_body add by default, while the body keeps its content
type. Before V4 the body has nowhere else to record its type, so removing
Content-Type from a part with a non-text body is refused.

Refs pact-foundation/pact-go#263

test(compatibility-suite): steps to remove a header from the expected and received requests

🤖 Generated with Claude Code

YOU54F and others added 3 commits November 2, 2026 13:53
… content type

When the actual request or response has no Content-Type header, its content
type is only a guess from the body bytes (the mock server stores that guess on
the body). Compare the body using the expected content type instead of
reporting a BodyTypeMismatch, so a binary body sent without a header can
match an expected application/octet-stream body.

Refs pact-foundation/pact-go#263

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Removes a header (case-insensitively) from the request or response of an
interaction, along with its matching rules and generators. This lets a
wrapper drop the Content-Type header that pactffi_with_body and
pactffi_with_binary_body add by default, while the body keeps its content
type. Before V4 the body has nowhere else to record its type, so removing
Content-Type from a part with a non-text body is refused.

Refs pact-foundation/pact-go#263

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and received requests

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.

1 participant