Skip to content

fix: support scalar request and response bodies in InteractionContents#404

Open
SAY-5 wants to merge 1 commit into
pact-foundation:masterfrom
SAY-5:fix-interaction-contents-scalar-body
Open

fix: support scalar request and response bodies in InteractionContents#404
SAY-5 wants to merge 1 commit into
pact-foundation:masterfrom
SAY-5:fix-interaction-contents-scalar-body

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jun 3, 2026

Copy link
Copy Markdown

Summary

InteractionContents assumed every body was a hash, so a plain-string or integer body (or an array of scalars nested in a hash, e.g. {some_array: [42]}) raised NoMethodError: undefined method 'each_pair' instead of serializing. serialize now returns non-collection values unchanged and a scalar body is exposed through #value for with_request/will_respond_with to pass to the FFI core.

Added specs covering a plain string body, an integer body, and an array of scalars nested in a hash.

Fixes #402

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@YOU54F

YOU54F commented Jun 10, 2026

Copy link
Copy Markdown
Member

Thanks Sai

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.

InteractionContents does not support raw strings neither integer values (and certainly more types)

2 participants