[BUG][PYTHON] Fix #23990: Account for content-type parameters on request preparation#23992
Open
MarcelKonrad wants to merge 5 commits into
Open
[BUG][PYTHON] Fix #23990: Account for content-type parameters on request preparation#23992MarcelKonrad wants to merge 5 commits into
MarcelKonrad wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
There was a problem hiding this comment.
2 issues found across 5 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
9485a6d to
f34fbbf
Compare
Contributor
Author
|
The pipeline failed because it could not pull the specified docker image due to a connection timeout, which is unrelated to this PR. |
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.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
Fixes #23990. A description and a guide on how to reproduce the issue can be found there.
The proposed changes include a new helper function called
contenttype_matchesthat returnstruewhen a given content-type string matches the given type and subtype, otherwise it returnsfalse. Mime type parameters are ignored, but can be optionally be present in the provided string. It also allows for vendor specifications. For example, application/vendor+json is also considered valid against type=application, subtype=json.@cbornet @tomplus @krjakbrjak @fa0311 @multani
Summary by cubic
Fixes #23990 by making the Python client’s content-type matching ignore parameters (including optional whitespace) and accept vendor suffixes so request bodies use the correct encoder.
contenttype_matcheshelper (case-insensitive, ignores MIME parameters/whitespace, supports+vendorsuffix).application/x-www-form-urlencoded, andmultipart/form-datadetection to use the helper.content_typefortext/*boolean handling.Written for commit f34fbbf. Summary will update on new commits.