Repository navigation
Preserve false request bodies for JSON encoding - #1691
Merged
iMacTia merged 4 commits intoOct 25, 2026
Merged
Conversation
iMacTia
approved these changes
Oct 25, 2026
iMacTia
left a comment
Member
There was a problem hiding this comment.
I checked with a JSON validator and false is indeed a valid JSON body, so this change makes sense. I just want to add a small test case to make sure this and other literals are correctly covered and tested
1 of 2 tasks
Member
|
Tests added in #1728, the PR CI is currently failing exactly on the This PR fixes that 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preserve false bodies so JSON middleware can encode them.
Reproduction and verification
With request :json and the test adapter echoing env.body, post('/', false) produces an empty string before the fix and 'false' afterward. Verified POST/PUT/PATCH, true/zero/hash/array/string bodies and block overrides.
Limitations
No test/spec files were added or changed because the originating repository explicitly forbids this. Reproductions ran outside the repository. This differs from Faraday's requested regression-test contribution convention and is disclosed for maintainer review. Other Ruby versions/platforms were not run locally. This PR includes only the focused source change; the other fixes and the consumer's separately verified merged JSON decoder patch #1687 are not added here.
Breaking-change notes
False now reaches middleware instead of being silently discarded. Nil behavior is unchanged.