Repository navigation
Match parsed form fields in request expectations - #520
Open
sricharanreddycheruku wants to merge 3 commits into
Open
sricharanreddycheruku wants to merge 3 commits into
sricharanreddycheruku wants to merge 3 commits into
Conversation
csernazs
reviewed
Oct 11, 2026
csernazs
reviewed
Oct 11, 2026
Owner
|
Thanks for your PR, I have a few comments only, otherwise looks good to me. |
csernazs
reviewed
Oct 11, 2026
Owner
|
Sorry for being late. Your PR looks good now. Can you squash your commits? Then I'm happy to merge it. Thanks for making the requested changes. Zsolt |
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.
Matching form-encoded request bodies currently requires a custom handler. This adds the
data_formargument proposed in #369 to compare Werkzeug's parsed form fields.A mapping compares the first value for each field, while a
MultiDictcompares all repeated values, consistently with query-string matching. Extra fields and missing empty-valued fields do not match. The raw body remains available to response handlers, and form expectations are mutually exclusive withdataandjson.The argument is available on normal, oneshot, ordered, baked and blocking expectations. Existing positional arguments and representations remain unchanged. When the new argument is unused, it is not forwarded to custom matcher factories or expectation overrides. Includes a how-to example, API docstrings, a release note and the updated source-package test inventory.
Original submission validation on Linux / Python 3.12.14 using locked development dependencies with Poetry 2.1.1:
data_formis absent.pytest -q tests --release): 171 passed, 3 skipped, 2 xfailed; one existing tar-extraction warning.pytest -q tests --ssl): 1 passed, 175 skips from SSL selection.make precommitandgit diff --check: passed.make doc: passed; the same 59 warnings occur on unchanged source, with no new warnings.Fixes #369
Revision after maintainer review:
data_form.tests/examples/test_howto_form_data.pyand included that tested file in the how-to documentation.application/x-www-form-urlencodedandmultipart/form-dataas the Content-Type values Werkzeug uses to parse form fields.Revision validation on Linux / Python 3.12.3 with pip-installed development dependencies and Poetry 2.1.1, rather than a lockfile installation:
git diff --checkpassed.