Repository navigation
fix(serialization): support content-type parameters in form factories - #868
Hardik K (hardikkaurani) wants to merge 4 commits into
Conversation
…actory Strip MIME parameters and surrounding whitespace from the content-type argument before comparing against the valid content type in FormParseNodeFactory.get_root_parse_node, aligning with RFC 2045 §5.1. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
…ntent-type parameters Add parameterized tests verifying that FormParseNodeFactory properly accepts content types with MIME parameters and case variations while continuing to reject delimiter-only and invalid content types. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
…ionWriterFactory Strip MIME parameters and surrounding whitespace from the content-type argument before comparing against the valid content type in FormSerializationWriterFactory.get_serialization_writer, aligning with RFC 2045 §5.1. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
…Factory content-type parameters Add parameterized tests verifying that FormSerializationWriterFactory properly accepts content types with MIME parameters and case variations while continuing to reject delimiter-only and invalid content types. Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
|
|
Opening this PR to ensure Previously, both factories performed strict equality checks on Parameterized regression tests covering charset parameters, whitespace variations, and delimiter edge cases have been added. All 149 package tests, mypy, and pylint (10/10) pass cleanly. |
|
Hi Hardik K (@hardikkaurani), thank you for your contribution! This pull request is being closed automatically because you currently have more than 10 open pull requests across the Kiota repositories. Reviewing takes time, and having this many pull requests open at once overwhelms the reviewers. Please avoid having more than 10 open pull requests at any given time. To move forward, you can either:
|
|
Hi Vincent, Thank you for letting me know, and I appreciate your continued guidance and patience. I'm sorry for having more than 10 open pull requests across the Kiota repositories and for creating additional review overhead. I understand that reviewing so many PRs at once takes considerable time from the maintainers. I'll focus on getting my existing PRs merged, respond promptly to review feedback, and close any older PRs that are no longer relevant. I'll make sure to keep my open PR count below 10 before submitting any new ones. Apologies again for the inconvenience, and thank you for the opportunity to contribute to Kiota. I appreciate your understanding. |
|
Hi Vincent Biret (@baywet), I currently have fewer than 10 open pull requests across the Kiota repositories. Would it be okay if I reopened this PR? |
|
Hi Vincent Biret (@baywet), GitHub doesn't allow me to reopen this PR from my end since it was closed by a maintainer. Whenever there's room under the 10-PR limit, could you please reopen it on your side? Thanks! |



Summary
FormParseNodeFactory.get_root_parse_node()andFormSerializationWriterFactory.get_serialization_writer()previously used strict equality againstapplication/x-www-form-urlencoded(valid_content_type.casefold() != content_type.casefold()).As a result, both factories rejected valid content types that contain MIME parameters (such as
application/x-www-form-urlencoded; charset=utf-8orapplication/x-www-form-urlencoded; charset=UTF-8) or whitespace around the parameter separator with aTypeError.Per RFC 2045 §5.1, media types and subtypes are parameter-agnostic for type identification. This change brings the Python form serialization factories to parity with the implementations in Kiota Java, .NET, TypeScript, and Go.
Changes
fix): UpdatedFormParseNodeFactory.get_root_parse_nodeto strip MIME parameters and surrounding whitespace (content_type.split(";")[0].strip().casefold()) before comparing againstvalid_content_type.casefold().test): Added parameterized tests totest_form_parse_node_factory.pyasserting acceptance of content types with MIME parameters (charset=utf-8,charset=UTF-8), whitespace variants, and case variations, while continuing to reject delimiter-only and invalid content types.fix): UpdatedFormSerializationWriterFactory.get_serialization_writerto strip MIME parameters and surrounding whitespace before comparing againstvalid_content_type.casefold().test): Added parameterized tests totest_form_serialization_writer_factory.pyasserting acceptance of content types with MIME parameters, whitespace variants, and case variations, while continuing to reject delimiter-only and invalid content types.Verification
cd packages/serialization/formpytest: 149/149 passed (100% test pass rate).mypy kiota_serialization_form: no issues found in 6 source files.pylint kiota_serialization_form --disable=W --rcfile=.pylintrc: 10.00/10.yapf -dr kiota_serialization_form: clean.cd packages/bundle && pytest: 2/2 passed.