You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Form serialization trims field names and merges distinct fields #892
FormSerializationWriter strips leading and trailing whitespace from field names before encoding them. As a result, distinct names such as field and field become the same form field.
This reproduces with unmodified main at 2150d1593be67ea5d5bd7040c4f99d6139e8d094, using only public APIs:
fromurllib.parseimportparse_qslfromkiota_serialization_form.form_parse_nodeimportFormParseNodefromkiota_serialization_form.form_serialization_writerimportFormSerializationWriterwriter=FormSerializationWriter()
writer.write_str_value("field", "first")
writer.write_str_value(" field ", "second")
content=writer.get_serialized_content().decode("utf-8")
print(content)
print(parse_qsl(content))
print(FormParseNode(content).get_child_node(" field "))
Expected: field=first&+field+=second, preserving both names. The form serialization algorithm percent-encodes the original name and value. It does not trim the name.
The same trimming occurs when writing an object under a key and when writing a non-parsable object. Names containing only whitespace become empty names. This affects callers whose form properties or additional-data keys contain surrounding whitespace; I have not verified a downstream production incident.
PR #791 fixed whitespace in values and explicitly left key normalization unchanged. This report concerns names. Empty/absent keys and values are outside the proposed change.
Verified locally on Windows with CPython 3.13.7. Regression cases should preserve ASCII and Unicode whitespace in names, distinguish padded names from their unpadded counterparts, and cover all three writer paths.
Activity