Repository navigation
fix(serialization-form): preserve whitespace in string values - #791
Merged
Vincent Biret (baywet) merged 2 commits intoOct 13, 2026
Merged
Vincent Biret (baywet) merged 2 commits into
Vincent Biret (baywet) merged 2 commits into
Conversation
Vincent Biret (baywet)
approved these changes
Oct 13, 2026
Vincent Biret (baywet)
left a comment
Member
There was a problem hiding this comment.
Thanks for the contribution!
Vincent Biret (baywet)
enabled auto-merge
October 13, 2026 13:24
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation matches the documented behavior and has appropriate regression coverage.
0 open findings
What changed in this PR
Preserves whitespace in form-serialized string values without changing key normalization or empty-value omission.
Changes:
- Encodes original string values without stripping whitespace.
- Adds regression tests for whitespace, Unicode, and omitted values.
| File | Description |
|---|---|
form_serialization_writer.py |
Removes value trimming before encoding. |
test_form_serialization_writer.py |
Covers whitespace preservation and omission behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
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.



Fixes #789.
Form string serialization trims leading and trailing whitespace, changing the supplied payload.
write_str_value calls strip on the value before percent-encoding it. Encode the original string value. Existing key normalization and omission of None/empty strings remain unchanged.
Added standard-library parse_qs regressions for surrounding whitespace, whitespace-only values and Unicode whitespace; retained plain-value and None/empty omission controls.
Validation: five new cases fail before the correction; all 63 form tests pass locally after it. YAPF, isort, Pylint and mypy pass. Pylint prints the existing suggestion-mode configuration diagnostic (exit 0), also reproduced on unchanged main and upstream CI.
Fork validation: run 38161550435, tested commit
3dc5580abe640436b521e0449fc0c4ace9834755, target79370e7ee8171a42abc828376dcbc331c27623e8, fork-only workflow revisionc517af083bb74af2a9877dc97eef434f8e014d70.All 46 jobs for this commit passed: eight packages across Python 3.10–3.14 with upstream formatting/import/Pylint/mypy/pytest commands, generated-code type checks on all five versions, and CodeQL. Each form run passed all 63 tests with no skips. CodeQL reported zero findings. Upstream import normalization is reproduced; the changed form package additionally needs no normalization. The validation workflow is separate from this PR.
The unchanged target passed upstream build run 37963997486; its form suite ran 55 tests successfully on each supported Python version.