Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ffi): annotate body in raw body branch #461

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

JP-Ellis
Copy link
Contributor

If the content type was not otherwise handled,
OptionalBody::from(&str) was used. This sets the content type associated with the body to None irrespective of the content type passed through to process_body.

This fixes the issue by ensuring the OptionalBody::Present is created with the appropriate content type.

@tienvx
Copy link
Contributor

tienvx commented Aug 30, 2024

Should we add a simple test to verify if it work and make sure this issue will not happen in the future?

Something like this:

pactffi_with_body('a=1&b=2&c=3&d=4', 'x-www-form-urlencoded')
assert_body('a=1&b=2&c=3&d=4')
assert_header_is_set('Content-Type', 'x-www-form-urlencoded')

If the content type was not otherwise handled,
`OptionalBody::from(&str)` was used. This sets the content type
associated with the body to `None` irrespective of the content type
passed through to `process_body`.

This fixes the issue by ensuring the `OptionalBody::Present` is created
with the appropriate content type.

Signed-off-by: JP-Ellis <[email protected]>
@JP-Ellis JP-Ellis force-pushed the fix/body-content-type-annotation branch from 0097515 to 59c9ff3 Compare August 30, 2024 04:57
@JP-Ellis JP-Ellis merged commit eb687a5 into master Aug 30, 2024
63 checks passed
@JP-Ellis JP-Ellis deleted the fix/body-content-type-annotation branch August 30, 2024 10:31
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.

3 participants